tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
M\¬Qc@sâdZddlZddlZddlZddlZddlZddlZddlZddlZddddgZ    ej
dZ dZ d    dd
„ƒYZ e ƒad Zd Zd Zd d„Zdejfd„ƒYZdejfd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdd d„ƒYZd„ZedkrÞeƒZejZdekrÁejdƒZ e!ee  e"ƒe#ƒd gƒZ$ee dZn ddl%Z$e&e$eƒZ'e'ej(ej)fej*ej+fƒZ,ej-r¹yddl.Z.Wn+e/k
rIej0dIJej1dƒnXe.j2dƒdZ3yej-e3ƒWq¹e4k
rµZ5e5jej6kr˜‚nej0dIJej1dƒq¹Xnyej7ƒWqÞe8k
rÚqÞXndS(!scAn 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 `PureProxy' 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.
iÿÿÿÿNt
SMTPServertDebuggingServert    PureProxyt MailmanProxyisPython SMTP proxy version 0.2tDevnullcBseZd„Zd„ZRS(cCsdS(N((tselftmsg((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pytwriteXscCsdS(N((R((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pytflushYs(t__name__t
__module__RR(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRWs    s
ts, cCs;tjttƒIJ|r*tj|IJntj|ƒdS(N(tsyststderrt__doc__tglobalstexit(tcodeR((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pytusagebst SMTPChannelcBs€eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „ZRS(iicCs
tjj||ƒ||_||_||_g|_|j|_d|_    d|_ g|_ d|_ tjƒ|_y|jƒ|_Wn:tjk
rÅ}|jƒ|dtjkrÁ‚ndSXtdIt|jƒIJ|jd|jtfƒ|jdƒdS(NiR sPeer:s    220 %s %ss
(tasynchatt
async_chatt__init__t_SMTPChannel__servert_SMTPChannel__connt_SMTPChannel__addrt_SMTPChannel__linetCOMMANDt_SMTPChannel__statet_SMTPChannel__greetingtNonet_SMTPChannel__mailfromt_SMTPChannel__rcpttost_SMTPChannel__datatsockettgetfqdnt_SMTPChannel__fqdnt getpeernamet_SMTPChannel__peerterrortcloseterrnotENOTCONNt DEBUGSTREAMtreprtpusht __version__tset_terminator(Rtservertconntaddrterr((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRms*                                 
cCstjj||dƒdS(Ns
(RRR-(RR((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyR-‡scCs|jj|ƒdS(N(Rtappend(Rtdata((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pytcollect_incoming_data‹sc    Csøtj|jƒ}tdIt|ƒIJg|_|j|jkró|sZ|jdƒdSd}|j    dƒ}|dkr|j
ƒ}d}n$|| j
ƒ}||dj ƒ}t |d|dƒ}|så|jd|ƒdS||ƒdS|j|j kr|jdƒdSg}xN|jd    ƒD]=}|r\|dd
kr\|j|dƒq,|j|ƒq,Wtj|ƒ|_|jj|j|j|j|jƒ}g|_d|_|j|_|jd    ƒ|sç|jd ƒn |j|ƒdS( NsData:s500 Error: bad syntaxt iitsmtp_s'502 Error: command "%s" not implementeds451 Internal confusions
t.s250 Ok(t EMPTYSTRINGtjoinRR+R,RRR-RtfindtuppertstriptgetattrtDATAtsplitR4tNEWLINER!Rtprocess_messageR&RR R/(    RtlinetmethodtitcommandtargR5ttexttstatus((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pytfound_terminatorsP           
            cCsQ|s|jdƒdS|jr0|jdƒn||_|jd|jƒdS(Ns501 Syntax: HELO hostnames503 Duplicate HELO/EHLOs250 %s(R-RR$(RRH((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_HELOÀs         cCs'|r|jdƒn |jdƒdS(Ns501 Syntax: NOOPs250 Ok(R-(RRH((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_NOOPÊscCs|jdƒ|jƒdS(Ns221 Bye(R-tclose_when_done(RRH((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_QUITÐs cCs„d}t|ƒ}|| jƒ|kr€||jƒ}|sAq€|ddkr€|ddkr€|dkr€|dd!}q€n|S(Nit<iÿÿÿÿt>s<>i(RtlenR=R>(RtkeywordRHtaddresstkeylen((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    __getaddrÖs ,cCsŒtdI|IJ|r(|jd|ƒnd}|sE|jdƒdS|jr_|jdƒdS||_tdI|jIJ|jdƒdS(Ns    ===> MAILsFROM:s501 Syntax: MAIL FROM:<address>s503 Error: nested MAIL commandssender:s250 Ok(R+t_SMTPChannel__getaddrRR-R(RRHRT((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_MAILãs          cCs“tdI|IJ|js*|jdƒdS|rB|jd|ƒnd}|s_|jdƒdS|jj|ƒtdI|jIJ|jdƒdS(Ns    ===> RCPTs503 Error: need MAIL commandsTO:s501 Syntax: RCPT TO: <address>srecips:s250 Ok(R+RR-RWRR R4(RRHRT((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_RCPTðs      cCsO|r|jdƒdSd|_g|_d|_|j|_|jdƒdS(Ns501 Syntax: RSETR s250 Ok(R-RRR R!RR(RRH((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_RSETýs              cCs[|js|jdƒdS|r1|jdƒdS|j|_|jdƒ|jdƒdS(Ns503 Error: need RCPT commands501 Syntax: DATAs
.
s#354 End data with <CR><LF>.<CR><LF>(R R-R@RR/(RRH((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    smtp_DATAs        (R    R
RR@RR-R6RKRLRMRORWRXRYRZR[(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRis                1    
                        cBs#eZd„Zd„Zd„ZRS(cCsª||_||_tjj|ƒy>|jtjtjƒ|j    ƒ|j
|ƒ|j dƒWn|j ƒ‚n0Xt d|jjtjtjƒƒ||fIJdS(Nis0%s started at %s
   Local addr: %s
   Remote addr:%s(t
_localaddrt _remoteaddrtasyncoret
dispatcherRt create_socketR"tAF_INETt SOCK_STREAMtset_reuse_addrtbindtlistenR(R+t    __class__R    ttimetctime(Rt    localaddrt
remoteaddr((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRs        
 
cCsQ|jƒ}|dk    rM|\}}tdt|ƒIJt|||ƒ}ndS(NsIncoming connection from %s(tacceptRR+R,R(RtpairR1R2tchannel((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt handle_accept)s
   cCs
t‚dS(sIOverride 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(tNotImplementedError(RtpeertmailfromtrcpttosR5((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRC1s(R    R
RRnRC(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRs        cBseZd„ZRS(cCs\d}|jdƒ}dGHx6|D].}|rJ| rJdG|dGHd}n|GHq!WdGHdS(Nis
s%---------- MESSAGE FOLLOWS ----------sX-Peer:is%------------ END MESSAGE ------------(RA(RRpRqRrR5t    inheaderstlinesRD((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRCLs           (R    R
RC(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRJscBseZd„Zd„ZRS(c    CsŠ|jdƒ}d}x"|D]}|s,Pn|d7}qW|j|d|dƒtj|ƒ}|j|||ƒ}tdI|IJdS(Ns
iis
X-Peer: %sswe got some refusals:(RAtinsertRBR;t_deliverR+(    RRpRqRrR5RtRFRDtrefused((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRCZs c Cs ddl}i}yU|jƒ}|j|jd|jdƒz|j|||ƒ}Wd|jƒXWnŸ|jk
r’}tdIJ|j}nwt    j
|j fk
r}tdI|j IJt |ddƒ}t |ddƒ}    x"|D]}
||    f||
<qëWnX|S(    Niÿÿÿÿiisgot SMTPRecipientsRefusedtgott    smtp_codet
smtp_errortignore(tsmtplibtSMTPtconnectR]tsendmailtquittSMTPRecipientsRefusedR+t
recipientsR"R't SMTPExceptionRfR?( RRqRrR5R|Rwtsteterrcodeterrmsgtr((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRvhs$  
  (R    R
RCRv(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRYs    cBseZd„ZRS(c    Csddlm}ddlm}ddlm}ddlm}g}    xµ|D]­}
|
jƒjdƒd} | jdƒ} t| ƒd    kr“qMn| d} t| ƒd    kr¼| d
}nd }|j    | ƒ sM|d!kräqMn|    j
|
| |fƒqMWx$|    D]\}
} }|j |
ƒqWt dIdj |ƒIJ|rl|j|||ƒ}t dI|IJni}||ƒ}|j|ƒ}|jdƒs©||d<n|jdƒsÔtjtjƒƒ|d<nx+|    D]#\}
} }t dI|
IJ|j| ƒ}|s1|j| ddƒ}||| <n|d krS|j|dd
ƒqÛ|d kru|j|dd
ƒqÛ|d kr—|j|dd
ƒqÛ|dkr¹|j|dd
ƒqÛ|d"krÛ|dkrÞd|d<n
d |d<|j|dd
ƒqÛqÛWdS(#Niÿÿÿÿ(tStringIO(tUtils(tMessage(tMailListt@it-iiR tadmintownertrequestR;tleavesforwarding recips:R7swe got refusals:tfromtFromtdatetDatessending message totlockttolistttoadminttoownert    torequestt    subscribetSubjectt unsubscribe(R RRR‘sjoinR’(sjoinR’(t    cStringIOR‰tMailmanRŠR‹RŒtlowerRARRt list_existsR4tremoveR+R;Rvt    getheaderRgRhtgettEnqueue(RRpRqRrR5R‰RŠR‹RŒt    listnamestrcpttlocaltpartstlistnameRGRwtmlistsR„Rtmlist((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRC‚sd 
               
(R    R
RC(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyRstOptionscBseZdZdZRS(iR(R    R
tsetuidt    classname(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyR®Ïsc    CsŠy5tjtjdddddddgƒ\}}Wn#tjk
rZ}td|ƒnXtƒ}xž|D]–\}}|dkrtd
ƒqk|dkr¹tjtIJtjd
ƒqk|dkrÑd
|_    qk|d kré||_
qk|d!krktja qkqkWt |ƒdkr&d}d}nht |ƒdkrK|d
}d}nCt |ƒdkrt|d
}|d}ntddt j|ƒƒ|jdƒ}|d
kr½tdd|ƒn|| |_yt||dƒ|_Wn"tk
r    tdd|ƒnX|jdƒ}|d
kr9tdd|ƒn|| |_yt||dƒ|_Wn"tk
r…tdd|ƒnX|S("NisnVhc:dsclass=tnosetuidtversionthelptdebugs-hs--helpis-Vs    --versions-ns
--nosetuids-cs--classs-ds--debugslocalhost:8025s localhost:25iisInvalid arguments: %st:sBad local spec: %ssBad local port: %ssBad remote spec: %ssBad remote port: %s(s-hs--help(s-Vs    --version(s-ns
--nosetuid(s-cs--class(s-ds--debug(tgetoptR targvR'RR®R R.RR¯R°R+RRt
COMMASPACER;R<t    localhosttintt    localportt
ValueErrort
remotehostt
remoteport(    toptstargsR…toptionstoptRHt    localspect
remotespecRF((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt    parseargsÔs\ "                 
    
       t__main__R9is7Cannot import module "pwd"; try running with -n option.tnobodyis3Cannot setuid "nobody"; try running with -n option.(((9RR tosR)R¶RgR"R^Rt__all__R·tprogramR.RR+RBR:R¸RRRR_RRRRR®RÅR    RÁR°trfindtlastdott
__import__RtlocalstmodRÆR?tclass_R¹R»R½R¾tproxyR¯tpwdt ImportErrorR RtgetpwnamRÇtOSErrorR…tEPERMtlooptKeyboardInterrupt(((sM/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/smtpd.pyt<module>$sn$              «6(N    8          "