pike.git / lib / modules / Protocols.pmod / SMTP.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/SMTP.pmod:226:   //! The low-level class for the SMTP server   class Connection {       inherit Configuration;    // The commands this module supports    array(string) commands = ({ "ehlo", "helo", "mail", "rcpt", "data",    "rset", "vrfy", "quit", "noop" });    constant protocol = "ESMTP";       // the fd of the socket -  static object fd = Stdio.File(); +  static Stdio.File fd = Stdio.File();    // the domains for each i relay    static array(string) mydomains = ({ });    // the input buffer for read_cb    static string inputbuffer = "";    // the size of the old data string in read_cb    static int sizeofpreviousdata = 0;    // the from address    static string mailfrom = "";    // to the address(es)    static array(string) mailto = ({ });
pike.git/lib/modules/Protocols.pmod/SMTP.pmod:277:    }       static void outcode(int code)    {    fd->write("%d %s\r\n", code, replycodes[code]);   #ifdef SMTP_DEBUG    log("%d %s\r\n", code, replycodes[code]);   #endif    }    +  //! This function is called whenever the SMTP server logs something. +  //! By default the log function is @[werror]. +  function(string:mixed) logfunction = werror; +     static void log(string fmt, mixed ... args)    {    string errmsg = Calendar.now()->format_time() + -  " Pike SMTP server : "; +  " Pike "+protocol+" server : ";    if(messageid)    errmsg += messageid + ": ";    errmsg += fmt + "\n"; -  werror(errmsg, args); +  logfunction(sprintf(errmsg, @args));    }       // make the received header    static string received()    {    string remotehost =    Protocols.DNS.client()->gethostbyaddr(remoteaddr)[0]    || remoteaddr;    string rec;    rec=sprintf("from %s (%s [%s]) by %s (Pike "+protocol+
pike.git/lib/modules/Protocols.pmod/SMTP.pmod:515:    message->headers->received = received()    + "\0"+message->headers->received;    if(!message->headers["message-id"])    {    message->headers["message-id"] = sprintf("<%d@%s>", messageid,    gethostname());    }    return message;    }    -  MIME.Message low_message(string content) +  static MIME.Message low_message(string content)    {    datamode = 0;    if(sizeof(content) > maxsize)    {    outcode(552);    return 0;    }    MIME.Message message;    mixed err = catch (message = MIME.Message(content));    if(err)
pike.git/lib/modules/Protocols.pmod/SMTP.pmod:613:    {    string _command = lower_case(command[0]);    mixed err = 0;    if(has_value(commands, _command))    {    err = catch    {   #ifdef SMTP_DEBUG    log("calling %O\n", _command);   #endif -  function fun = this_object()[_command]; +  function fun = this[_command];    fun(command[1..] * " ");    };    }    else    {    log("command %O not recognized", _command);    outcode(500);    }    if(err)    {
pike.git/lib/modules/Protocols.pmod/SMTP.pmod:655: Inside #if defined(SMTP_DEBUG)
  #ifdef SMTP_DEBUG    write("buffposition=%d, inputbuffer=%O\n", bufferposition, inputbuffer);   #endif    bufferposition += sizeof(pattern);    int end = bufferposition-(1+sizeof(pattern));    if(!datamode)    {    launch_functions(inputbuffer[..end]);    if(lower_case(inputbuffer[..end]) == "quit")    { -  destruct(this_object()); +  destruct(this);    return;    }    pattern = "\n";    }    if(datamode)    {    if(pattern=="\n.\n")    message(inputbuffer[..end+1]);    pattern = "\n.\n";    }