-í
ç¶<c       s|  d  Z  d k Z d k Z d k Z d k Z d k Z d k Z d k Z d k Z d d d d g Z	 e i
 d Z d Z d f  d	 „  ƒ  YZ e ƒ  a d
 Z d Z d Z d d „ Z d e i f d „  ƒ  YZ d e i f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d f  d „  ƒ  YZ d „  Z e d j o.e ƒ  Z e i o± y d k Z Wn- e  j
 o! e i! d IJe i" d ƒ n Xe i# d ƒ d Z$ y e i e$ ƒ WnI e% j
 o= Z& e& i e i' j o ‚  n e i! d IJe i" d ƒ n Xn d k( Z( e) e( e i* ƒ Z+ e+ e i, e i- f e i. e i/ f ƒ Z0 y e i1 ƒ  Wn e2 j
 o n Xn d S(   sc  An RFC 2821 smtp proxy.

Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]

Options:

    --nosetuid
    -n
        This program generally tries to setuid `nobody', unless this flag is
        set.  The setuid call will fail if this program is not run as root (in
        which case, use this flag).

    --version
    -V
        Print the version number and exit.

    --class classname
    -c classname
        Use `classname' as the concrete SMTP proxy class.  Uses `SMTPProxy' by
        default.

    --debug
    -d
        Turn on debugging prints.

    --help
    -h
        Print this message and exit.

Version: %(__version__)s

If localhost is not given then `localhost' is used, and if localport is not
given then 8025 is used.  If remotehost is not given then `localhost' is used,
and if remoteport is not given, then 25 is used.
Ns
   SMTPServers   DebuggingServers	   PureProxys   MailmanProxyi    s   Python SMTP proxy version 0.2s   Devnullc      s   t  Z d „  Z d „  Z RS(   Nc    s   d  S(   N(    (   s   selfs   msg(    (    s   /usr/lib/python2.2/smtpd.pys   writeY s    c    s   d  S(   N(    (   s   self(    (    s   /usr/lib/python2.2/smtpd.pys   flushZ s    (   s   __name__s
   __module__s   writes   flush(    (    (    s   /usr/lib/python2.2/smtpd.pys   DevnullX s   	s   
s    s   , c    s=   t  i t t ƒ  IJ| o t  i | IJn t  i |  ƒ d  S(   N(   s   syss   stderrs   __doc__s   globalss   msgs   exits   code(   s   codes   msg(    (    s   /usr/lib/python2.2/smtpd.pys   usaged s    s   SMTPChannelc      s€   t  Z d Z d Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   Ni    i   c    sÉ   t  i i |  | ƒ | |  _ | |  _ | |  _	 g  |  _
 |  i |  _ d |  _ t |  _ g  |  _ d |  _ t i ƒ  |  _ | i ƒ  |  _ t d It |  i ƒ IJ|  i d |  i t f ƒ |  i d ƒ d  S(   Ni    s    s   Peer:s	   220 %s %ss   
(   s   asynchats
   async_chats   __init__s   selfs   conns   servers   _SMTPChannel__servers   _SMTPChannel__conns   addrs   _SMTPChannel__addrs   _SMTPChannel__lines   COMMANDs   _SMTPChannel__states   _SMTPChannel__greetings   Nones   _SMTPChannel__mailfroms   _SMTPChannel__rcpttoss   _SMTPChannel__datas   sockets   getfqdns   _SMTPChannel__fqdns   getpeernames   _SMTPChannel__peers   DEBUGSTREAMs   reprs   pushs   __version__s   set_terminator(   s   selfs   servers   conns   addr(    (    s   /usr/lib/python2.2/smtpd.pys   __init__p s    								c    s   t  i i |  | d ƒ d  S(   Ns   
(   s   asynchats
   async_chats   pushs   selfs   msg(   s   selfs   msg(    (    s   /usr/lib/python2.2/smtpd.pys   push‚ s    c    s   |  i i | ƒ d  S(   N(   s   selfs   _SMTPChannel__lines   appends   data(   s   selfs   data(    (    s   /usr/lib/python2.2/smtpd.pys   collect_incoming_data† s    c 	   s  t  i |  i ƒ } t d It | ƒ IJg  |  _ |  i |  i j oÂ | o |  i	 d ƒ d  Sn t
 } | i d ƒ } | d j  o | i ƒ  } t
 } n% | |  i ƒ  } | | d i ƒ  } t |  d | t
 ƒ } | o |  i	 d | ƒ d  Sn | | ƒ d  Sn|  i |  i j o |  i	 d ƒ d  Sn g  } xQ | i d	 ƒ D]@ } | o | d d
 j o | i | d ƒ n | i | ƒ qDWt i | ƒ |  _ |  i i |  i |  i |  i |  i ƒ } g  |  _ t
 |  _ |  i |  _ |  i  d	 ƒ | o |  i	 d ƒ n |  i	 | ƒ d  S(   Ns   Data:s   500 Error: bad syntaxs    i    i   s   smtp_s'   502 Error: command "%s" not implementeds   451 Internal confusions   
s   .s   250 Ok(!   s   EMPTYSTRINGs   joins   selfs   _SMTPChannel__lines   lines   DEBUGSTREAMs   reprs   _SMTPChannel__states   COMMANDs   pushs   Nones   methods   finds   is   uppers   commands   args   strips   getattrs   DATAs   datas   splits   texts   appends   NEWLINEs   _SMTPChannel__datas   _SMTPChannel__servers   process_messages   _SMTPChannel__peers   _SMTPChannel__mailfroms   _SMTPChannel__rcpttoss   statuss   set_terminator(	   s   selfs   statuss   is   texts   commands   args   lines   datas   method(    (    s   /usr/lib/python2.2/smtpd.pys   found_terminatorŠ sR    	

 		c    sY   | o |  i d ƒ d  Sn |  i o |  i d ƒ n | |  _ |  i d |  i ƒ d  S(   Ns   501 Syntax: HELO hostnames   503 Duplicate HELO/EHLOs   250 %s(   s   args   selfs   pushs   _SMTPChannel__greetings   _SMTPChannel__fqdn(   s   selfs   arg(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_HELO» s    
	c    s)   | o |  i d ƒ n |  i d ƒ d  S(   Ns   501 Syntax: NOOPs   250 Ok(   s   args   selfs   push(   s   selfs   arg(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_NOOPÅ s    c    s   |  i d ƒ |  i ƒ  d  S(   Ns   221 Bye(   s   selfs   pushs   close_when_done(   s   selfs   arg(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_QUITË s    c    s‘   t  } t | ƒ } | |  i ƒ  | j o` | | i ƒ  } | o nA | d d j o | d d j o
 | d j o | d d !} n n | Sd  S(   Ni    s   <iÿÿÿÿs   >s   <>i   (   s   Nones   addresss   lens   keywords   keylens   args   uppers   strip(   s   selfs   keywords   args   addresss   keylen(    (    s   /usr/lib/python2.2/smtpd.pys	   __getaddrÑ s    /c    s‹   t  d I| IJ|  i d | ƒ } | o |  i d ƒ d  Sn |  i o |  i d ƒ d  Sn | |  _ t  d I|  i IJ|  i d ƒ d  S(   Ns	   ===> MAILs   FROM:s   501 Syntax: MAIL FROM:<address>s   503 Error: nested MAIL commands   sender:s   250 Ok(   s   DEBUGSTREAMs   args   selfs   _SMTPChannel__getaddrs   addresss   pushs   _SMTPChannel__mailfrom(   s   selfs   args   address(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_MAILÞ s    
	c    sÂ   t  d I| IJ|  i o |  i d ƒ d  Sn |  i d | ƒ } | o |  i d ƒ d  Sn | i ƒ  i d ƒ o |  i d | ƒ d  Sn |  i	 i
 | ƒ t  d I|  i	 IJ|  i d ƒ d  S(	   Ns	   ===> RCPTs   503 Error: need MAIL commands   TO:s   501 Syntax: RCPT TO: <address>s   stimpys   503 You suck %ss   recips:s   250 Ok(   s   DEBUGSTREAMs   args   selfs   _SMTPChannel__mailfroms   pushs   _SMTPChannel__getaddrs   addresss   lowers
   startswiths   _SMTPChannel__rcpttoss   append(   s   selfs   args   address(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_RCPTë s    c    sT   | o |  i d ƒ d  Sn t |  _ g  |  _ d |  _ |  i |  _ |  i d ƒ d  S(   Ns   501 Syntax: RSETs    s   250 Ok(	   s   args   selfs   pushs   Nones   _SMTPChannel__mailfroms   _SMTPChannel__rcpttoss   _SMTPChannel__datas   COMMANDs   _SMTPChannel__state(   s   selfs   arg(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_RSETû s    			c    sf   |  i o |  i d ƒ d  Sn | o |  i d ƒ d  Sn |  i |  _ |  i d ƒ |  i d ƒ d  S(   Ns   503 Error: need RCPT commands   501 Syntax: DATAs   
.
s#   354 End data with <CR><LF>.<CR><LF>(   s   selfs   _SMTPChannel__rcpttoss   pushs   args   DATAs   _SMTPChannel__states   set_terminator(   s   selfs   arg(    (    s   /usr/lib/python2.2/smtpd.pys	   smtp_DATAs    (   s   __name__s
   __module__s   COMMANDs   DATAs   __init__s   pushs   collect_incoming_datas   found_terminators	   smtp_HELOs	   smtp_NOOPs	   smtp_QUITs   _SMTPChannel__getaddrs	   smtp_MAILs	   smtp_RCPTs	   smtp_RSETs	   smtp_DATA(    (    (    s   /usr/lib/python2.2/smtpd.pys   SMTPChannell s   				1	
						c      s#   t  Z d „  Z d „  Z d „  Z RS(   Nc    s   | |  _ | |  _ t i i |  ƒ |  i t	 i
 t	 i ƒ |  i ƒ  |  i | ƒ |  i d ƒ t d |  i i t i t i ƒ  ƒ | | f IJd  S(   Ni   s0   %s started at %s
	Local addr: %s
	Remote addr:%s(   s	   localaddrs   selfs
   _localaddrs
   remoteaddrs   _remoteaddrs   asyncores
   dispatchers   __init__s   create_sockets   sockets   AF_INETs   SOCK_STREAMs   set_reuse_addrs   binds   listens   DEBUGSTREAMs	   __class__s   __name__s   times   ctime(   s   selfs	   localaddrs
   remoteaddr(    (    s   /usr/lib/python2.2/smtpd.pys   __init__s    		
c    s<   |  i ƒ  \ } } t d t | ƒ IJt |  | | ƒ } d  S(   Ns   Incoming connection from %s(   s   selfs   accepts   conns   addrs   DEBUGSTREAMs   reprs   SMTPChannels   channel(   s   selfs   addrs   conns   channel(    (    s   /usr/lib/python2.2/smtpd.pys   handle_accept"s    c    s
   t  ‚ d S(   sI  Override this abstract method to handle messages from the client.

        peer is a tuple containing (ipaddr, port) of the client that made the
        socket connection to our smtp port.

        mailfrom is the raw address the client claims the message is coming
        from.

        rcpttos is a list of raw addresses the client wishes to deliver the
        message to.

        data is a string containing the entire full text of the message,
        headers (if supplied) and all.  It has been `de-transparencied'
        according to RFC 821, Section 4.5.2.  In other words, a line
        containing a `.' followed by other text has had the leading dot
        removed.

        This function should return None, for a normal `250 Ok' response;
        otherwise it returns the desired response string in RFC 821 format.

        N(   s   NotImplementedError(   s   selfs   peers   mailfroms   rcpttoss   data(    (    s   /usr/lib/python2.2/smtpd.pys   process_message(s     (   s   __name__s
   __module__s   __init__s   handle_accepts   process_message(    (    (    s   /usr/lib/python2.2/smtpd.pys
   SMTPServers   		c      s   t  Z d „  Z RS(   Nc    s_   d } | i d ƒ } d GHx9 | D]1 } | o | o d G| d GHd } n | GHq! Wd GHd  S(   Ni   s   
s%   ---------- MESSAGE FOLLOWS ----------s   X-Peer:i    s%   ------------ END MESSAGE ------------(   s	   inheaderss   datas   splits   liness   lines   peer(   s   selfs   peers   mailfroms   rcpttoss   datas   lines	   inheaderss   lines(    (    s   /usr/lib/python2.2/smtpd.pys   process_messageDs     
	(   s   __name__s
   __module__s   process_message(    (    (    s   /usr/lib/python2.2/smtpd.pys   DebuggingServerBs   c      s   t  Z d „  Z d „  Z RS(   Nc 	   s‡   | i d ƒ } d } x% | D] } | o Pn | d 7} q W| i | d | d ƒ t i | ƒ } |  i
 | | | ƒ } t d IJd  S(   Ns   
i    i   s
   X-Peer: %ss   we got some refusals(   s   datas   splits   liness   is   lines   inserts   peers   NEWLINEs   joins   selfs   _delivers   mailfroms   rcpttoss   refuseds   DEBUGSTREAM(	   s   selfs   peers   mailfroms   rcpttoss   datas   is   liness   refuseds   line(    (    s   /usr/lib/python2.2/smtpd.pys   process_messageSs     c    s  d  k  }	 h  } yU |	 i ƒ  } | i |  i d |  i d ƒ z | i | | | ƒ } Wd  | i ƒ  XWn£ |	 i j
 o } t d IJ| i } nz t i |	 i f j
 oa } t d I| i IJt | d d ƒ } t | d d ƒ }
 x | D] } | |
 f | | <që Wn X| Sd  S(	   Ni    i   s   got SMTPRecipientsRefuseds   gots	   smtp_codeiÿÿÿÿs
   smtp_errors   ignore(   s   smtplibs   refuseds   SMTPs   ss   connects   selfs   _remoteaddrs   sendmails   mailfroms   rcpttoss   datas   quits   SMTPRecipientsRefuseds   es   DEBUGSTREAMs
   recipientss   sockets   errors   SMTPExceptions	   __class__s   getattrs   errcodes   errmsgs   r(   s   selfs   mailfroms   rcpttoss   datas   es   errcodes   refuseds   ss   rs   smtplibs   errmsg(    (    s   /usr/lib/python2.2/smtpd.pys   _deliveras(    	 
 (   s   __name__s
   __module__s   process_messages   _deliver(    (    (    s   /usr/lib/python2.2/smtpd.pys	   PureProxyRs   	c      s   t  Z d „  Z RS(   Nc    s*  d k  l }
 d k l } d k l } d k l } g  } xÎ | D]Æ } | i	 ƒ  i
 d ƒ d } | i
 d ƒ } t | ƒ d j o qA n | d } t | ƒ d j o | d	 } n d
 } | i | ƒ p | d
 d d d d d f j o qA n | i | | | f ƒ qA Wx$ | D] \ } } } | i | ƒ qWt d Id i | ƒ IJ| o# |  i | | | ƒ } t d IJn h  } |
 | ƒ } | i | ƒ } | i d ƒ o | | d <n | i d ƒ o t i t i ƒ  ƒ | d <n x@| D]8\ } } } t d I| IJ| i  | ƒ }	 |	 o# | i | d d ƒ}	 |	 | | <n | d
 j o | i" |	 d d	 ƒn¼ | d j o | i" |	 d d	 ƒn˜ | d j o | i" |	 d d	 ƒnt | d j o | i" |	 d d	 ƒnP | d d f j o< | d j o d | d <n d | d <| i" |	 d d	 ƒn qêWd  S(    N(   s   StringIO(   s   Utils(   s   Message(   s   MailLists   @i    s   -i   i   s    s   admins   owners   requests   joins   leaves   forwarding recips:s    s   we got refusalss   froms   Froms   dates   Dates   sending message tos   locks   tolists   toadmins   toowners	   torequests	   subscribes   Subjects   unsubscribe(#   s	   cStringIOs   StringIOs   Mailmans   Utilss   Messages   MailLists	   listnamess   rcpttoss   rcpts   lowers   splits   locals   partss   lens   listnames   commands   list_existss   appends   removes   DEBUGSTREAMs   joins   selfs   _delivers   mailfroms   datas   refuseds   mlistss   ss   msgs	   getheaders   times   ctimes   gets   mlists   Enqueue(   s   selfs   peers   mailfroms   rcpttoss   datas	   listnamess   listnames   mlistss   refuseds   mlists   StringIOs   Utilss   MailLists   rcpts   ss   partss   commands   msgs   Messages   local(    (    s   /usr/lib/python2.2/smtpd.pys   process_message|sh     
0  
(   s   __name__s
   __module__s   process_message(    (    (    s   /usr/lib/python2.2/smtpd.pys   MailmanProxy{s   s   Optionsc      s   t  Z d Z d Z RS(   Ni   s	   PureProxy(   s   __name__s
   __module__s   setuids	   classname(    (    (    s   /usr/lib/python2.2/smtpd.pys   OptionsÊs   c  	   sÆ  y5 t  i  t i d d d d d d d g ƒ \ } } Wn% t  i j
 o } t d | ƒ n Xt ƒ  } xÆ | D]¾ \ }  } |  d d	 f j o t d
 ƒ n’ |  d d f j o t i t IJt i d
 ƒ na |  d d f j o d
 | _ nA |  d d f j o | | _ n! |  d d f j o t i a n qm Wt | ƒ d j  o d } d } nm t | ƒ d j  o | d
 } d } nF t | ƒ d j  o | d
 } | d } n t d d t i | ƒ ƒ | i d ƒ } | d
 j  o t d d | ƒ n | |  | _ y t | | d ƒ | _ Wn$ t j
 o t d d | ƒ n X| i d ƒ } | d
 j  o t d d | ƒ n | |  | _ y t | | d ƒ | _ Wn$ t j
 o t d d | ƒ n X| Sd  S(   Ni   s   nVhc:ds   class=s   nosetuids   versions   helps   debugs   -hs   --helpi    s   -Vs	   --versions   -ns
   --nosetuids   -cs   --classs   -ds   --debugs   localhost:8025s   localhost:25i   i   s   Invalid arguments: %ss   :s   Bad local spec: %ss   Bad local port: %ss   Bad remote spec: %ss   Bad remote port: %s(   s   getopts   syss   argvs   optss   argss   errors   es   usages   Optionss   optionss   opts   args   stderrs   __version__s   exits   setuids	   classnames   DEBUGSTREAMs   lens	   localspecs
   remotespecs
   COMMASPACEs   joins   finds   is	   localhosts   ints	   localports
   ValueErrors
   remotehosts
   remoteport(	   s   opts   es   is   argss	   localspecs
   remotespecs   args   optionss   opts(    (    s   /usr/lib/python2.2/smtpd.pys	   parseargsÐs^     "	 



s   __main__s7   Cannot import module "pwd"; try running with -n option.i   s   nobodyi   s3   Cannot setuid "nobody"; try running with -n option.(3   s   __doc__s   syss   oss   errnos   getopts   times   sockets   asyncores   asynchats   __all__s   argvs   programs   __version__s   Devnulls   DEBUGSTREAMs   NEWLINEs   EMPTYSTRINGs
   COMMASPACEs   usages
   async_chats   SMTPChannels
   dispatchers
   SMTPServers   DebuggingServers	   PureProxys   MailmanProxys   Optionss	   parseargss   __name__s   optionss   setuids   pwds   ImportErrors   stderrs   exits   getpwnams   nobodys   OSErrors   es   EPERMs   __main__s   getattrs	   classnames   class_s	   localhosts	   localports
   remotehosts
   remoteports   proxys   loops   KeyboardInterrupt(   s   Optionss   nobodys   asyncores   times   syss   class_s   pwds   __main__s   proxys   Devnulls   EMPTYSTRINGs   __version__s   DebuggingServers   asynchats   es   sockets   __all__s	   parseargss   MailmanProxys   NEWLINEs	   PureProxys   programs   errnos   usages   getopts   SMTPChannels
   SMTPServers   oss   optionss
   COMMASPACE(    (    s   /usr/lib/python2.2/smtpd.pys   ?$ s`   %									§/)O	9	
 	