Spade
Mini Shell
�
{�fc@s�dZddlZddlZddlZddlZddlZdZdejfd��YZdd#d d$dd
ddddddddgZ x�e
ee ��D]�Ze eZ
ee
�ed�kr�eje
ej�Z
nBgZx*e
D]"Z
ejeje
ej��q�Wee�Z
[e
e e<[
q�W[ddejdej�ejd�ejdej�gZejdejejB�Zd�ZegZd�Zd�Zd
�Zed!ks�ejd"ekr�e�ndS(%s6mailerdaemon - classes
to parse mailer-daemon
messagesi����Nsmailerdaemon.UnparseabletErrorMessagecBs#eZd�Zd�Zd�ZRS(cCs
tjj||�d|_dS(Nt(trfc822tMessaget__init__tsub(tselftfp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyR
scCsU|jd�}|sdS|j�}|jd�r8dSd|krHdS||_dS(NtSubjectiswaiting
mailitwarning(t getheadertlowert
startswithR(RR((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
is_warnings cCsPxCtD];}|j�y||j|j�SWqtk
rAqXqWt�dS(N(t EMPARSERSt
rewindbodyRRtUnparseable(Rtp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt
get_errorss
(t__name__t
__module__RR
R(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyRs
s.error: (?P<reason>unresolvable): (?P<email>.+)s?----- The
following addresses had permanent fatal errors -----
s(?P<email>[^
].*)
( .*
)?s(remote execution.*
.*rmail (?P<email>.+)s8The following recipients did not receive your
message:
sK +(?P<email>.*)
(The following recipients did not receive your message:
)?s?------- Failure Reasons --------
(?P<reason>.*)
(?P<email>.*)s ^<(?P<email>.*)>:
(?P<reason>.*)s=^(?P<reason>User mailbox exceeds allowed size):
(?P<email>.+)s0^5\d{2} <(?P<email>[^
>]+)>\.\.\. (?P<reason>.+)s)^Original-Recipient:
rfc822;(?P<email>.*)sR^did not reach the following recipient\(s\):
(?P<email>.*) on .*
+(?P<reason>.*)s+^ <(?P<email>[^
>]+)> \.\.\. (?P<reason>.*)s@^Report on your message to:
(?P<email>.*)
Reason: (?P<reason>.*)s^^Your message was not delivered to
+(?P<email>.*)
+for the following reason:
+(?P<reason>.*)sO^ was not +(?P<email>[^
].*?) *
.*
.*
.*
because:.*
+(?P<reason>[^
].*?) *
Rs^5\d{2} <>\.\.\. (?P<reason>.*)s<>\.\.\.
(?P<reason>.*)s^<<< 5\d{2} (?P<reason>.*)s,=====
stderr was =====
rmail: (?P<reason>.*)s ^Diagnostic-Code:
(?P<reason>.*)s^From:cCs|j�}tj|�}|dkr6t|�}n|jd�}g}g}d}x)tD]!}t|�td�kr|dj|d|�}|dk ry|jd�}Wnt k
r�nXxK|dj
||jd�|�}|dkr�Pn|j|jd��q�Pqq^|j|d|�}|dk r^|j|jd��y|jd�}Wnt k
rznXPq^q^W|s�t
�n|s�|}|d
dkr�|d}nxtD]}t|�td�kr�x�tt|�ddd�D]�} || }
tjtj|
�j|jd ��tj�}|j|�}|dk r�|jd
j|
j�d|jd�j���|| =q�q�Wq�n|j|�}|dk r�|jd�}Pq�q�Wnx8|D]0}
|jd
j|
j�d|j���q�W|S(
Nitreasonitemailisreturned mail:
Ri����s<>t s:
((treadtemparse_list_fromtsearchtNonetlentstarttemparse_list_listttypetgroupt
IndexErrortmatchtendtappendRtemparse_list_reasontrangetretcompiletescapetjointsplitt MULTILINEtstrip(RRtdatatrest
from_indexterrorstemailsRtregexptiRtexp((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytemparse_list\sj
"
#
03
.cCs@t|�}t|�}||kr(dS||kr8dSdSdS(Ni����ii(tint(tatb((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytsort_numeric�scCs�tj|�tjd�}i}i}i}d}}}t|d�tjd��} | jt�x�| D]�}
t|
�}t |�}|j
d�}
d|
|
dfG|j�r�|j�dGH|d}|rntj
|
d |
�qnqnny|j�}Wn-tk
r4d
GH|d}|j�qnnXt|�GdGHx�|D]�}y7|jd�dd!\}}dtj||f}Wn
d}nX|j|�s�d||<d|
|f||<n||d||<d|
|f||<qKW|j�|d}|rntj
|
d |
�qnqnWdGH|GdG|GdG|GdGHdGHg}x9|j�D]+}|j|||||||f�q]W|j�x/|D]'\}}}}d||||fGHq�WdS(Ns^[0-9]*$icSs|j|�dk S(N(R"R(tfntpat((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<lambda>�st.tFroms %s %-40s iswarning
onlyt,s** Not parseableR1tdateis%s %02ds??????s%s
(%s)s--------------s
files parsed,sfiles warning-only,sfiles
unparseables
%d %s -
%s %si(tostchdirR'R(tfiltertlistdirtsortR:topenRtgetaddrR
tclosetrenameRRRtgetdatetcalendart
month_abbrthas_keytkeysR$(tdirtmodifyR<t errordictt
errorfirstt errorlasttnoktnwarntnbadtfilesR;RtmtsenderR1tetmmtddRAtlisttnumtfirsttlast((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytparsedir�sj
)
cCs�d}ttj�dkrAtjddkrAd}tjd=nttj�dkr~x2tjdD]}t||�qdWn
td|�dS(Niis-ds/ufs/jack/Mail/errorsinbox(RtsystargvRb(RQtfolder((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pytmain�s(
t__main__i(s?-----
The following addresses had permanent fatal errors -----
s(?P<email>[^
].*)
( .*
)?(s8The following recipients did not receive your message:
sK +(?P<email>.*)
(The following recipients did not receive your message:
)?(t__doc__RRLR'RBRcRRRRR&RR4txRR(R,txlR$ttupleR%t
IGNORECASERR6RR:RbRfRRd(((s2/usr/lib64/python2.7/Tools/scripts/mailerdaemon.pyt<module>s`$
9 D