+
    BiZx                     l   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
 ^ RIHt ^ RIHtHt . ROt]P"                  ^ ,          tR	t ! R
 R4      t]! 4       sRtRtRtR R lt ! R R]
P4                  4      t ! R R]	P8                  4      t ! R R]4      t ! R R]4      t ! R R4      t R t!]"R8X  Ed   ]!! 4       t#]#PH                  t$R]$9   d8   ]$PK                  R4      t&]'! ]$R]& ](! 4       ])! 4       R.4      t*]$]&^,           R t$M^ RI+t*],! ]*]$4      t-]-! ]#P\                  ]#P^                  3]#P`                  ]#Pb                  3]#Pd                  ]#Pf                  R7      t4]#Pj                  '       d2    ^ RI6t6]6Pv                  ! R4      ^,          t< ]Pj                  ! ]<4        ]	P|                  ! 4        R# R#   ]7 d*    ]8! R]Pr                  R7       ]Pt                  ! ^4        Lqi ; i  ]= d*    ]8! R]Pr                  R7       ]Pt                  ! ^4        Lxi ; i  ]? d     R# i ; i)!a  An RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions.

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 'PureProxy' by
        default.

    --size limit
    -s limit
        Restrict the total size of the incoming message to "limit" number of
        bytes via the RFC 1870 SIZE extension.  Defaults to 33554432 bytes.

    --smtputf8
    -u
        Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy.

    --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.
N)asyncoreasynchat)warn)get_addr_specget_angle_addrSMTPChannel
SMTPServerDebuggingServer	PureProxyzPython SMTP proxy version 0.3c                   ,   a  ] tR t^\t o R tR tRtV tR# )Devnullc                    R # N selfmsgs   &&)/usr/lib/python3.14/test/support/smtpd.pywriteDevnull.write]   s    $    c                    R # r   r   r   s   &r   flushDevnull.flush^   s    Tr   r   N)__name__
__module____qualname____firstlineno__r   r   __static_attributes____classdictcell____classdict__s   @r   r   r   \   s     r   r   
z, i    c                     \        \        \        4       ,          \        P                  R 7       V'       d   \        V\        P                  R 7       \        P
                  ! V 4       R# )fileN)print__doc__globalssysstderrexit)coder   s   &&r   usager/   g   s3    	'GI
CJJ/
c

#HHTNr   c                   (  a  ] tR t^nt o ^ t^tRt]P                  ! ]3R l4      t	]
R 4       t]RRR3R ltR tR t]
R	 4       t]P"                  R
 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       t]
R 4       t]P"                  R 4       tR tR  tR! tR" tR# t R$ t!R% t"R& t#R' t$R( t%R) t&R* t'R+ t(R, t)R- t*R. t+R/ t,R0t-V t.R# )1r   i   c                    V # r   r   )xs   &r   <lambda>SMTPChannel.<lambda>s   s    qr   c                     \        V P                  P                  4       4      #   \         d    T P                  u # i ; ir   )maxcommand_size_limitsvalues
ValueErrorcommand_size_limitr   s   &r   max_command_size_limit"SMTPChannel.max_command_size_limitu   s<    	+t//66899 	+***	+s   "% ??NFc                \   \         P                  P                  WVR 7       Wn        W n        W0n        W@n        W`n        Wpn        V'       d   V'       d   \        R4      hV'       d"   RV n
        RV n        RV n        \        V n        M%RV n
        RV n        \        R4      V n        RV n        V P!                  4        RV n        R	V n        V P&                  P)                  4        \*        P,                  ! 4       V n         VP1                  4       V n        \=        R\?        T P2                  4      \@        R7       T PC                  RT P.                  : R\D        : 24       R
#   \4         d<   pT P7                  4        TP8                  \8        P:                  8w  d   h  R
p?R
# R
p?ii ; i)mapFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer$   
.r      
   .   
FNzPeer:r&   z220  )#r   
async_chat__init__smtp_serverconnaddrdata_size_limitenable_SMTPUTF8_decode_datar9   _emptystring_linesep_dotsepNEWLINE_newlineord_set_rset_stateseen_greetingextended_smtpr7   clearsocketgetfqdnfqdngetpeernamepeerOSErrorcloseerrnoENOTCONNr(   reprDEBUGSTREAMpush__version__)	r   serverrJ   rK   rL   r?   rM   decode_dataerrs	   &&&&&&&& r   rH   SMTPChannel.__init__|   sG   $$TS$9!		..'{ @ A A "D"DMDL#DM #D#DMt9DL!DM"  &&(NN$		((*DI 	gtDII[9		K89  	 JJLyyENN*	s   E% %F+00F&&F+c                    V P                   V n        RV n        . V n        RV n        ^ V n        V P                  R4       R# )z/Reset state variables to their post-DATA state.NFrC   )COMMAND
smtp_statemailfromrcpttosrequire_SMTPUTF8	num_bytesset_terminatorr   s   &r   _set_post_data_state SMTPChannel._set_post_data_state   s8    ,, %G$r   c                B    V P                  4        RV n        . V n        R# )z.Reset all state variables except the greeting.r$   N)rr   received_datareceived_linesr   s   &r   rU   SMTPChannel._set_rset_state   s    !!# r   c                <    \        R \        ^4       V P                  # )zTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' insteadr   DeprecationWarningrI   r   s   &r   __serverSMTPChannel.__server   s!     ();Q	@r   c                4    \        R \        ^4       Wn        R# )zRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadNry   r   values   &&r   r{   r|      s     ();Q	@ r   c                <    \        R \        ^4       V P                  # )zUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadr   rz   rv   r   s   &r   __lineSMTPChannel.__line   s!     +,>	C"""r   c                4    \        R \        ^4       Wn        R# )zSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadNr   r~   s   &&r   r   r      s     +,>	C#r   c                <    \        R \        ^4       V P                  # )zRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadr   rz   rl   r   s   &r   __stateSMTPChannel.__state   s     '(:A	?r   c                4    \        R \        ^4       Wn        R# )zPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadNr   r~   s   &&r   r   r      s     '(:A	?r   c                <    \        R \        ^4       V P                  # )zXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadr   rz   rV   r   s   &r   
__greetingSMTPChannel.__greeting   !     *+=q	B!!!r   c                4    \        R \        ^4       Wn        R# )zVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadNr   r~   s   &&r   r   r           *+=q	B"r   c                <    \        R \        ^4       V P                  # )zSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadr   rz   rm   r   s   &r   
__mailfromSMTPChannel.__mailfrom   s     %&8!	=}}r   c                4    \        R \        ^4       Wn        R# )zQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadNr   r~   s   &&r   r   r      s     %&8!	=r   c                <    \        R \        ^4       V P                  # )zQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadr   rz   rn   r   s   &r   	__rcpttosSMTPChannel.__rcpttos   s     $%7	<||r   c                4    \        R \        ^4       Wn        R# )zOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadNr   r~   s   &&r   r   r      s     $%7	<r   c                <    \        R \        ^4       V P                  # )zTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadr   rz   ru   r   s   &r   __dataSMTPChannel.__data   r   r   c                4    \        R \        ^4       Wn        R# )zRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadNr   r~   s   &&r   r   r      r   r   c                <    \        R \        ^4       V P                  # )zKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadr   rz   r[   r   s   &r   __fqdnSMTPChannel.__fqdn       !"4a	9yyr   c                4    \        R \        ^4       Wn        R# )zISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadNr   r~   s   &&r   r   r          !"4a	9	r   c                <    \        R \        ^4       V P                  # )zKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadr   rz   r]   r   s   &r   __peerSMTPChannel.__peer  r   r   c                4    \        R \        ^4       Wn        R# )zISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadNr   r~   s   &&r   r   r     r   r   c                <    \        R \        ^4       V P                  # )zKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadr   rz   rJ   r   s   &r   __connSMTPChannel.__conn  r   r   c                4    \        R \        ^4       Wn        R# )zISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadNr   r~   s   &&r   r   r     r   r   c                <    \        R \        ^4       V P                  # )zKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadr   rz   rK   r   s   &r   __addrSMTPChannel.__addr"  r   r   c                4    \        R \        ^4       Wn        R# )zISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadNr   r~   s   &&r   r   r   '  r   r   c                    \         P                  P                  T \        VR ,           V P                  '       d   RMR4      4       R# )rA   utf-8asciiN)r   rG   rd   bytesro   r   s   &&r   rd   SMTPChannel.push.  s7      u&LT%:%:%:'(I 	Jr   c                   R pV P                   V P                  8X  d   V P                  pM'V P                   V P                  8X  d   V P                  pV'       d   V P
                  V8  d   R # V'       d#   V ;P
                  \        V4      ,          un        V P                  '       d(   V P                  P                  \        VR4      4       R # V P                  P                  V4       R # )Nr   )rl   rk   r;   DATArL   rp   lenrN   rv   appendstr)r   datalimits   && r   collect_incoming_data!SMTPChannel.collect_incoming_data3  s    ??dll*//E__		)((ET^^e+NNc$i'N&&s4'9:&&t,r   c                   V P                   P                  V P                  4      p\        R \	        V4      \
        R7       . V n        V P                  V P                  8X  Ed.   V P                  ^ uq n        V'       g   V P                  R4       R# V P                  '       g   \        VR4      pVP                  R4      pV^ 8  d   VP                  4       pRpM,VRV P                  4       pW^,           R P                  4       pV P                  '       d   V P                   V,          MV P"                  pW&8  d   V P                  R4       R# \%        V RV,           R4      pV'       g   V P                  RV,          4       R# V! V4       R# V P                  V P&                  8w  d   V P                  R	4       ^ V n        R# V P(                  '       d6   V P                  V P(                  8  d   V P                  R
4       ^ V n        R# . pVP+                  V P,                  4       FN  p	V	'       d3   V	^ ,          V P.                  8X  d   VP1                  V	R,          4       K=  VP1                  V	4       KP  	  V P2                  P                  V4      V n        V P6                  V P8                  V P:                  V P4                  3p
/ pV P                  '       g   RV P<                  RV P>                  /pV P@                  PB                  ! V
/ VB pV PE                  4        V'       g   V P                  R4       R# V P                  V4       R# )zData:r&   z500 Error: bad syntaxNr   rF   z500 Error: line too longsmtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data   NNmail_optionsrcpt_options250 OK)#rO   joinrv   r(   rb   rc   rl   rk   rp   rd   rN   r   findupperstriprW   r7   r:   getattrr   rL   splitrP   rQ   r   rS   ru   r]   rm   rn   r   r   rI   process_messagerr   )r   lineszicommandargmax_szmethodr   textargskwargsstatuss   &            r   found_terminatorSMTPChannel.found_terminatorC  s     %%d&9&9:gtDz4 ??dll*!%B		12$$$4)		#A1u**,r(..*Q34j&&(--- ..w7373J3J {		45T7W#4d;F		BWLM3K$))+		23!"###9M9M(M		9:!" D

4==1DGt||3KKR)KK%	 2
 "&!3!3D!9DIIt}}dllD<N<NODF$$$"D$5$5"D$5$5 %%55tFvFF%%'		(#		&!r   c                    V'       g   V P                  R 4       R# V P                  '       d   V P                  R4       R# V P                  4        Wn        V P                  RV P                  ,          4       R# )z501 Syntax: HELO hostnameN503 Duplicate HELO/EHLOz250 %s)rd   rV   rU   r[   r   r   s   &&r   	smtp_HELOSMTPChannel.smtp_HELO  sX    II12II/0 		(TYY&'r   c                   V'       g   V P                  R 4       R# V P                  '       d   V P                  R4       R# V P                  4        Wn        RV n        V P                  RV P                  ,          4       V P
                  '       dB   V P                  RV P
                  ,          4       V P                  R;;,          ^,          uu&   V P                  '       g   V P                  R4       V P                  '       d1   V P                  R4       V P                  R;;,          ^
,          uu&   V P                  R	4       R# )
z501 Syntax: EHLO hostnameNr   Tz250-%sz250-SIZE %sMAILz250-8BITMIMEz250-SMTPUTF8z250 HELP)	rd   rV   rU   rW   r[   rL   r7   rN   rM   r   s   &&r   	smtp_EHLOSMTPChannel.smtp_EHLO  s    II12II/0 !		(TYY&'IImd&:&::;$$V,2,   IIn%IIn%$$V,2,		*r   c                ^    V'       d   V P                  R 4       R# V P                  R4       R# )z501 Syntax: NOOPr   Nrd   r   s   &&r   	smtp_NOOPSMTPChannel.smtp_NOOP  s    II()IIhr   c                H    V P                  R 4       V P                  4        R# )z221 ByeN)rd   close_when_doner   s   &&r   	smtp_QUITSMTPChannel.smtp_QUIT  s    		)r   c                p    \        V4      pVR V P                  4       V8X  d   W#R  P                  4       # R# )Nr$   )r   r   r   )r   keywordr   keylens   &&& r   _strip_command_keyword"SMTPChannel._strip_command_keyword  s8    Ww<7*w<%%''r   c                    V'       g   R# VP                  4       P                  R4      '       d   \        V4      w  r#M\        V4      w  r#V'       g   W#3# VP                  V3# )r$   <)r$   r$   )lstrip
startswithr   r   	addr_spec)r   r   addressrests   &&  r   _getaddrSMTPChannel._getaddr  sW    M::<""3''*3/MGT)#.MG=   $&&r   c                    / pV FN  pVP                  R 4      w  r4pVP                  4       '       d   V'       d   V'       g    R# V'       d   TMRW#&   KP  	  V# )=NT)	partitionisalnum)r   paramsresultparameqr   s   &&    r   
_getparamsSMTPChannel._getparams  sJ     E$s3Eu==??b%'ETFM	 
 r   c                   V'       EdH   R pVP                  4       pVR8X  d   V P                  R4       R# VR8X  d   V P                  R4       R# VR8X  d0   RpV P                  '       d	   WB,          pV P                  V4       R# VR8X  d0   RpV P                  '       d	   WB,          pV P                  V4       R# VR	8X  d   V P                  R
4       R# VR8X  d   V P                  R4       R# VR8X  d   V P                  R4       R# VR8X  d   V P                  R4       R# VR8X  d   V P                  R4       R# V P                  R4       R# V P                  R4       R# ) [SP <mail-parameters>]EHLOz250 Syntax: EHLO hostnameHELOz250 Syntax: HELO hostnamer   z 250 Syntax: MAIL FROM: <address>RCPTz250 Syntax: RCPT TO: <address>r   z250 Syntax: DATARSETz250 Syntax: RSETNOOPz250 Syntax: NOOPQUITz250 Syntax: QUITVRFYz250 Syntax: VRFY <address>zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYN)r   rd   rW   )r   r   extendedlc_argr   s   &&   r   	smtp_HELPSMTPChannel.smtp_HELP  s$   30HYY[F		566!		566!8%%%OC		#6!6%%%OC		#6!		,-6!		,-6!		,-6!		,-6!		67		 5 6 II , -r   c                    V'       dI   V P                  V4      w  r#V'       d   V P                  R 4       R# V P                  RV,          4       R# V P                  R4       R# )zB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>N)r   rd   )r   r   r   r  s   &&  r   	smtp_VRFYSMTPChannel.smtp_VRFY  sJ    "mmC0OG		 1 2 		1C78II23r   c                   V P                   '       g   V P                  R 4       R# \        RV\        R7       RpV P                  '       d
   VR,          pVf   V P                  V4       R# V P                  RV4      pV P                  V4      w  r4V'       g   V P                  V4       R# V P                  '       g   V'       d   V P                  V4       R# V P                  '       d   V P                  R4       R# VP                  4       P                  4       V n
        V P                  V P                  4      pVf   V P                  V4       R# V P                  '       g-   VP                  RR	4      pVR9  d   V P                  R
4       R# V P                  '       d:   VP                  RR4      pVRJ d	   RV n        MVRJd   V P                  R4       R# VP                  RR4      pV'       di   VP!                  4       '       g   V P                  V4       R# V P"                  '       d.   \%        V4      V P"                  8  d   V P                  R4       R# \'        VP)                  4       4      ^ 8  d   V P                  R4       R# W0n        \        RV P                  \        R7       V P                  R4       R# )503 Error: send HELO firstNz	===> MAILr&   z 501 Syntax: MAIL FROM: <address>r	  zFROM:z503 Error: nested MAIL commandBODY7BITz1501 Error: BODY can only be one of 7BIT, 8BITMIMESMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsSIZEz:552 Error: message size exceeds fixed maximum message sizez:555 MAIL FROM parameters not recognized or not implementedzsender:r   )r  8BITMIME)rV   rd   r(   rc   rW   r   r   rm   r   r   r   r  rN   poprM   ro   isdigitrL   intr   keys)r   r   	syntaxerrr   r  bodysmtputf8sizes   &&      r   	smtp_MAILSMTPChannel.smtp_MAIL  s   !!!II23k3[16	22I;IIi ))'37--,IIi !!!fIIi ===II67"LLN002!2!23>IIi    ::ff-D//		MNzz*e4H4(,%&		BCzz&$'<<>>		)$%%%#d)d6J6J*J		VWv{{}!IIRSi[9		(r   c                   V P                   '       g   V P                  R 4       R# \        RV\        R7       V P                  '       g   V P                  R4       R# RpV P
                  '       d
   VR,          pVf   V P                  V4       R# V P                  RV4      pV P                  V4      w  r4V'       g   V P                  V4       R# V P
                  '       g   V'       d   V P                  V4       R# VP                  4       P                  4       V n
        V P                  V P                  4      pVf   V P                  V4       R# \        VP                  4       4      ^ 8  d   V P                  R4       R# V P                  P                  V4       \        R	V P                  \        R7       V P                  R
4       R# )r  Nz	===> RCPTr&   z503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r	  zTO:z8555 RCPT TO parameters not recognized or not implementedzrecips:r   )rV   rd   r(   rc   rm   rW   r   r   r   r   r   r  r   r"  rn   r   )r   r   r#  r   r  s   &&   r   	smtp_RCPTSMTPChannel.smtp_RCPT.  sT   !!!II23k3[1}}}II454	22I;IIi ))%5--,IIi !!!fIIi "LLN002!2!23>IIi v{{}!IIPQG$iK8		(r   c                ~    V'       d   V P                  R 4       R# V P                  4        V P                  R4       R# )z501 Syntax: RSETNr   )rd   rU   r   s   &&r   	smtp_RSETSMTPChannel.smtp_RSETQ  s-    II()		(r   c                6   V P                   '       g   V P                  R 4       R# V P                  '       g   V P                  R4       R# V'       d   V P                  R4       R# V P                  V n        V P                  R4       V P                  R4       R# )r  Nz503 Error: need RCPT commandz501 Syntax: DATAs   
.
z#354 End data with <CR><LF>.<CR><LF>)rV   rd   rn   r   rl   rq   r   s   &&r   	smtp_DATASMTPChannel.smtp_DATAX  sp    !!!II23|||II45II()))L)		78r   c                (    V P                  R 4       R# )z502 EXPN not implementedNr   r   s   &&r   	smtp_EXPNSMTPChannel.smtp_EXPNg  s    		,-r   )rN   rQ   rO   rP   rS   rK   rJ   rL   rM   rW   r[   r   rm   rp   r]   r   rn   ru   rv   ro   rV   rI   rl   )/r   r   r   r   rk   r   r:   collectionsdefaultdictr7   propertyr;   DATA_SIZE_DEFAULTrH   rr   rU   _SMTPChannel__serversetter_SMTPChannel__line_SMTPChannel__state_SMTPChannel__greeting_SMTPChannel__mailfrom_SMTPChannel__rcpttos_SMTPChannel__data_SMTPChannel__fqdn_SMTPChannel__peer_SMTPChannel__conn_SMTPChannel__addrrd   r   r   r   r   r   r   r   r   r  r  r  r'  r*  r-  r0  r3  r   r    r!   s   @r   r   r   n   s    GD%11;M2PQ+ + <M5e%:N%!     __! !
 # # ]]$ $
   ^^   
 " " # #
    
    
 " " ]]# #
   ]] 
   ]] 
   ]] 
   ]] J
- ;"|
(, 
	'	!-F	44l!F9. .r   c                   B   a  ] tR tRt o ]t]RRR3R ltR tR t	Rt
V tR# )r   ik  NFc           	        Wn         W n        W0n        WPn        W`n        V'       d   V'       d   \        R 4      h\        P                  P                  WR7        \        P                  '       d   ^ M\        P                  p\        P                  ! VRVR\        P                  / pV P                  V^ ,          ^ ,          V^ ,          ^,          4       V P                  4        V P!                  V4       V P#                  ^4       \%        V P&                  P(                  : R\*        P,                  ! \*        P*                  ! 4       4      : RV: RV: 2\.        R7       R#    T P1                  4        h ; i)	r@   r>   familytypez started at z
	Local addr: z
	Remote addr:r&   N)
_localaddr_remoteaddrrL   rM   rN   r9   r   
dispatcherrH   rY   has_ipv6AF_INETgetaddrinfoSOCK_STREAMcreate_socketset_reuse_addrbindlistenr(   	__class__r   timectimerc   r_   )	r   	localaddr
remoteaddrrL   r?   rM   rg   rG  gai_resultss	   &&&&&&&  r   rH   SMTPServer.__init__o  s!    $%..'{ @ A A$$T$3	: ///Qv~~F ,,i F F282D2DFK{1~a0+a.2CD!IIi KKN
 ''DIIK)@:'-8:		JJLs   B.E& &E9c           	         \        R \        V4      ,          \        R7       V P                  V VVV P                  V P
                  V P                  V P                  4      pR# )zIncoming connection from %sr&   N)r(   rb   rc   channel_classrL   _maprM   rN   )r   rJ   rK   channels   &&& r   handle_acceptedSMTPServer.handle_accepted  sP    +d4j8{K$$T%)%)%)%9%9%)YY%)%9%9%)%6%68r   c                    \         h)ah  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.

kwargs is a dictionary containing additional information.  It is
empty if decode_data=True was given as init parameter, otherwise
it will contain the following keys:
    'mail_options': list of parameters to the mail command.  All
                    elements are uppercase strings.  Example:
                    ['BODY=8BITMIME', 'SMTPUTF8'].
    'rcpt_options': same, for the rcpt command.

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

)NotImplementedErrorr   r]   rm   rn   r   r   s   &&&&&,r   r   SMTPServer.process_message  s
    > "!r   )rN   rI  rJ  rL   rM   )r   r   r   r   r   r\  r8  rH   r_  r   r   r    r!   s   @r   r   r   k  s*     M "3!&E::8" "r   c                   ,   a  ] tR tRt o R tR tRtV tR# )r	   i  c                N   ^pVP                  4       pV F  pV'       dV   V'       gN   RV^ ,          ,           p\        V\        4      '       g   \        VP	                  R4      4      p\        V4       ^ p\        V\        4      '       g   \        V4      p\        V4       K  	  R# )r   zX-Peer: r   N)
splitlines
isinstancer   rb   encoder(   )r   r]   r   	inheaderslinesr   
peerheaders   &&&    r   _print_message_content&DebuggingServer._print_message_content  s|    	!D'$q'1
!$,,!%j&7&7&@!AJj!	dC((Dz$K r   c                $   \        R 4       V'       da   VP                  R4      '       d   \        RVR,          ,          4       VP                  R4      '       d   \        RVR,          ,          4       V P                  W4       \        R4       R# )z%---------- MESSAGE FOLLOWS ----------r   zmail options: %sr   zrcpt options: %s
z%------------ END MESSAGE ------------N)r(   getrm  rc  s   &&&&&,r   r   DebuggingServer.process_message  si    56zz.))(6.+AABzz.))*VN-CCD##D/56r   r   N)r   r   r   r   rm  r   r   r    r!   s   @r   r	   r	     s     "7 7r   c                   >   a a ] tR tRt oV 3R ltR tR tRtVtV ;t	# )r
   i  c                r   < R V9   d   VR ,          '       d   \        R4      h\        \        V `  ! V/ VB  R# )rM   z$PureProxy does not support SMTPUTF8.N)r9   superr
   rH   )r   r   r   rT  s   &*,r   rH   PureProxy.__init__  s6    &62C+D+DCDDi'88r   c                   VP                  R 4      p^ pV F  pV'       g    MV^,          pK  	  VP                  VRV^ ,          ,          4       \        P                  V4      pV P	                  W#V4      p\        RV\        R7       R# )r#   z
X-Peer: %szwe got some refusals:r&   N)r   insertrR   r   _deliverr(   rc   )	r   r]   rm   rn   r   rk  r   r   refuseds	   &&&&&    r   r   PureProxy.process_message  sr    

4 DFA  	QtAw./||E"--48%w[Ar   c                L   ^ RI p/ p VP                  4       pVP                  V P                  ^ ,          V P                  ^,          4        VP	                  WV4      pVP                  4        V#   TP                  4        i ; i  TP                   d)   p\        R\        R7       TP                  p Rp?T# Rp?i\        TP                  3 dP   p\        RTP                  \        R7       \        TRR4      p\        TRR4      p	T F  p
Y3YZ&   K
  	   Rp?T# Rp?ii ; i)	    Nzgot SMTPRecipientsRefusedr&   got	smtp_code
smtp_errorignore)smtplibSMTPconnectrJ  sendmailquitSMTPRecipientsRefusedr(   rc   
recipientsr^   SMTPExceptionrT  r   )r   rm   rn   r   r  ry  seerrcodeerrmsgrs   &&&&       r   rx  PureProxy._deliver  s    	/AIId&&q)4+;+;A+>?**X=  ,, 	#-K@llG  ../ 	/%;7 ab1GQh7F%.
 	/sC   AB A1 B 1BB D#B::D#D#ADD#r   )
r   r   r   r   rH   r   rx  r   r    __classcell__)rT  r"   s   @@r   r
   r
     s     9
B r   c                   &    ] tR tRtRtRtRtRtRtR# )Optionsi  Tr
   NFr   )	r   r   r   r   setuid	classname
size_limitrM   r   r   r   r   r  r    s    FIJOr   r  c                      \         P                   ! \        P                  R ,          R. RO4      w  r\        4       pX  F  w  rEVR9   d   \	        ^ 4       K  VR9   d(   \        \        4       \        P                  ! ^ 4       KG  VR9   d
   RVn	        KW  VR9   d	   WSn
        Kf  VR9   d   \        P                  sK  VR9   d
   RVn        K  VR9   g   K   \        V4      pWcn        K  	  \!        X4      ^8  d   RpRpMe\!        V4      ^8  d   V^ ,          pRpMI\!        V4      ^8  d   V^ ,          pV^,          pM&\	        ^R	\"        P%                  V4      ,          4       XP'                  R
4      p	V	^ 8  d   \	        ^RV,          4       VRV	 Vn         \        Wy^,           R 4      Vn        XP'                  R
4      p	V	^ 8  d   \	        ^RV,          4       VRV	 Vn         \        W^,           R 4      Vn        V#   \         P                   d   p\	        ^T4        Rp?ELRp?ii ; i   \        RT,           \        P                  R7       \        P                  ! ^4        EK5  ; i  \,         d    \	        ^RT,          4        Li ; i  \,         d    \	        ^RT,          4        T# i ; i)r   z	nVhc:s:duNFTzInvalid size: r&   zlocalhost:8025zlocalhost:25zInvalid arguments: %s:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)zclass=nosetuidversionhelpzsize=debugr%  )z-hz--help)z-Vz	--version)z-nz
--nosetuid)z-cz--class)z-dz--debug)z-uz
--smtputf8)z-sz--size)getoptr+   argverrorr/   r  r(   re   r-   r  r  r,   rc   rM   r!  r  r   
COMMASPACEr   r   	localhost	localportr9   
remotehost
remoteport)
optsr   r  optionsoptr   int_size	localspec
remotespecr   s
             r   	parseargsr    sc   ]]HHRL+
 iG""!H''+HHQK(("GN%% #%%**K((&*G#$$s8%-"# . 4y1}$	#
	TQG	#
	TQG	!W
a(:??4+@@A 	sA1ua%	12!"1G3	A#$0 	A1ua&34#BQG5 aCD!12 Nq << a,&,3::>,  3a%	123  5a&34N5sG   1H H6I7 ,J H3H..H36:I47JJJ=<J=__main__rB   )rM   z7Cannot import module "pwd"; try running with -n option.r&   nobodyz3Cannot setuid "nobody"; try running with -n option.)r   r   r	   r
   )r$   )@r)   r+   osr`   r  rU  rY   r5  test.supportr   r   warningsr   email._header_value_parserr   r   __all__r  programre   r   rc   rR   r  r8  r/   rG   r   rK  r   r	   r
   r  r  r   r  r  rfindlastdot
__import__r*   localsmodr  r   class_r  r  r  r  r  rM   proxyr  pwdImportErrorr(   r,   r-   getpwnamr  PermissionErrorloopKeyboardInterruptr   r   r   <module>r     s)  +N  	      +  D ((1+- 
 i

 z.(%% z.zK"$$ K"\7j 7<*
 *Z ?D zkG!!I
i//#&8G,giB4Hgaij)	S)$FG%%w'8'89&&(:(:;%%w7N7NPE ~~~	 h'*	IIf7 "  	KRUR\R\]HHQK	  	GcjjYHHQK	
  s6   <G G5 -H( -G21G25-H%$H%(H32H3