%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/test/support/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/test/support/__pycache__/smtpd.cpython-312.pyc

�

���fx��(�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddl
mZmZgd�Zej"dZdZGd�d	�Ze�ad
ZdZdZd#d�ZGd�de
j4�ZGd�de	j8�ZGd�de�ZGd�de�ZGd�d�Z d�Z!e"dk(r�e!�Z#e#jHZ$de$vr3e$jKd�Z&e'e$de&e(�e)�d
g�Z*e$e&dzdZ$nddl+Z*e,e*e$�Z-e-e#j\e#j^fe#j`e#jbfe#jde#jf��Z4e#jjr-	ddl6Z6e6jvd �d!Z<	ejje<�	e	j|�yy#e7$r)e8dejr��ejtd�Y�iwxYw#e=$r)e8d"ejr��ejtd�Y�rwxYw#e?$rYywxYw)$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�	PureProxyzPython SMTP proxy version 0.3c��eZdZd�Zd�Zy)�Devnullc��y�N���self�msgs  �)/usr/lib/python3.12/test/support/smtpd.py�writez
Devnull.write]���c��yrr�rs r�flushz
Devnull.flush^rrN)�__name__�
__module__�__qualname__rrrrrr
r
\s���rr
�
z, i�c��ttt�ztj��|rt|tj��tj
|�y)N��file)�print�__doc__�globals�sys�stderr�exit)�coders  r�usager*gs3��	�'�G�I�
�C�J�J�/�
�
�c��
�
�#��H�H�T�Nrc��eZdZdZdZdZejefd��Ze	d��Z
edddfd�Zd	�Z
d
�Ze	d��Zej d��Ze	d
��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d��Ze	d��Zej d ��Zd!�Zd"�Zd#�Zd$�Zd%�Zd&�Z d'�Z!d(�Z"d)�Z#d*�Z$d+�Z%d,�Z&d-�Z'd.�Z(d/�Z)d0�Z*d1�Z+y)2rr�ic��|Srr)�xs r�<lambda>zSMTPChannel.<lambda>ss��q�rc��	t|jj��S#t$r|jcYSwxYwr)�max�command_size_limits�values�
ValueError�command_size_limitrs r�max_command_size_limitz"SMTPChannel.max_command_size_limitus<��	+��t�/�/�6�6�8�9�9���	+��*�*�*�	+�s�"%�=�=NFc�4�tjj|||��||_||_||_||_||_||_|r
|rtd��|r!d|_
d|_d|_t|_n%d|_
d|_td�|_d	|_|j!�d|_d
|_|j&j)�t+j,�|_	|j1�|_t=dt?|j2�t@��|jCd
|j.�dtD���y#t4$r8}|j7�|j8t8j:k7r�Yd}~yd}~wwxYw)N��map�Fdecode_data and enable_SMTPUTF8 cannot be set to True at the same timer�
�.r�
�.�
FzPeer:r!z220 � )#r�
async_chat�__init__�smtp_server�conn�addr�data_size_limit�enable_SMTPUTF8�_decode_datar4�_emptystring�_linesep�_dotsep�NEWLINE�_newline�ord�_set_rset_state�
seen_greeting�
extended_smtpr2�clear�socket�getfqdn�fqdn�getpeername�peer�OSError�close�errno�ENOTCONNr#�repr�DEBUGSTREAM�push�__version__)	r�serverrDrErFr9rG�decode_data�errs	         rrBzSMTPChannel.__init__|sU�����$�$�T�4�S�$�9�!�����	���	�.���.���'����{��@�A�
A�� "�D��"�D�M��D�L�#�D�M� #�D��#�D�M��t�9�D�L�!�D�M��������"���� � �&�&�(��N�N�$��	�	��(�(�*�D�I�	�g�t�D�I�I��[�9��	�	����K�8�9���	�
�J�J�L��y�y�E�N�N�*����
	�s�6E�	F�.F�Fc��|j|_d|_g|_d|_d|_|j
d�y)z/Reset state variables to their post-DATA state.NFrr=)�COMMAND�
smtp_state�mailfrom�rcpttos�require_SMTPUTF8�	num_bytes�set_terminatorrs r�_set_post_data_statez SMTPChannel._set_post_data_state�s8���,�,�����
���� %���������G�$rc�@�|j�d|_g|_y)z.Reset all state variables except the greeting.rN)rk�
received_data�received_linesrs rrOzSMTPChannel._set_rset_state�s���!�!�#���� ��rc�<�tdtd�|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead��r�DeprecationWarningrCrs r�__serverzSMTPChannel.__server�s!���(�);�Q�	@����rc�4�tdtd�||_y)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrprq�r�values  rrszSMTPChannel.__server�s���(�);�Q�	@� ��rc�<�tdtd�|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrp�rrrrnrs r�__linezSMTPChannel.__line�s!���+�,>��	C��"�"�"rc�4�tdtd�||_y)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrprxrus  rryzSMTPChannel.__line�s���+�,>��	C�#��rc�<�tdtd�|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrp�rrrrers r�__statezSMTPChannel.__state�s���'�(:�A�	?����rc�4�tdtd�||_y)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrpr|rus  rr}zSMTPChannel.__state�s���'�(:�A�	?���rc�<�tdtd�|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrp�rrrrPrs r�
__greetingzSMTPChannel.__greeting��!���*�+=�q�	B��!�!�!rc�4�tdtd�||_y)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrpr�rus  rr�zSMTPChannel.__greeting�����*�+=�q�	B�"��rc�<�tdtd�|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrp�rrrrfrs r�
__mailfromzSMTPChannel.__mailfrom�s���%�&8�!�	=��}�}�rc�4�tdtd�||_y)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrpr�rus  rr�zSMTPChannel.__mailfrom�s���%�&8�!�	=���
rc�<�tdtd�|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrp�rrrrgrs r�	__rcpttoszSMTPChannel.__rcpttos�s���$�%7��	<��|�|�rc�4�tdtd�||_y)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrpr�rus  rr�zSMTPChannel.__rcpttos�s���$�%7��	<���rc�<�tdtd�|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrp�rrrrmrs r�__datazSMTPChannel.__data�r�rc�4�tdtd�||_y)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrpr�rus  rr�zSMTPChannel.__data�r�rc�<�tdtd�|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrp�rrrrUrs r�__fqdnzSMTPChannel.__fqdn����!�"4�a�	9��y�y�rc�4�tdtd�||_y)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrpr�rus  rr�zSMTPChannel.__fqdn����!�"4�a�	9���	rc�<�tdtd�|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrp�rrrrWrs r�__peerzSMTPChannel.__peerr�rc�4�tdtd�||_y)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrpr�rus  rr�zSMTPChannel.__peerr�rc�<�tdtd�|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrp�rrrrDrs r�__connzSMTPChannel.__connr�rc�4�tdtd�||_y)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrpr�rus  rr�zSMTPChannel.__connr�rc�<�tdtd�|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrp�rrrrErs r�__addrzSMTPChannel.__addr"r�rc�4�tdtd�||_y)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrpr�rus  rr�zSMTPChannel.__addr'r�rc��tjj|t|dz|jrd��yd��y)Nr;�utf-8�ascii)rrAr^�bytesrhrs  rr^zSMTPChannel.push.sA����� � ��u��&�L�T�%:�%:�'�(I�	J�@G�(I�	Jrc��d}|j|jk(r
|j}n%|j|jk(r|j}|r|j
|kDry|r|xj
t
|�z
c_|jr&|jjt|d��y|jj|�y)Nr�)rerdr6�DATArFri�lenrHrn�append�str)r�data�limits   r�collect_incoming_dataz!SMTPChannel.collect_incoming_data3s������?�?�d�l�l�*��/�/�E�
�_�_��	�	�
)��(�(�E��T�^�^�e�+��
��N�N�c�$�i�'�N�������&�&�s�4��'9�:����&�&�t�,rc���|jj|j�}tdt	|�t
��g|_|j|jk(�r|jdc}|_|s|jd�y|jst|d�}|jd�}|dkr|j�}d}n)|d|j�}||dzdj�}|jr|j |n|j"}||kDr|jd�yt%|d	|zd�}|s|jd
|z�y||�y|j|j&k7r|jd�d|_y|j(r2|j|j(kDr|jd�d|_yg}|j+|j,�D]<}	|	r'|	d|j.k(r|j1|	dd��,|j1|	��>|j2j|�|_|j6|j8|j:|j4f}
i}|js|j<|j>d
�}|j@jB|
i|��}|jE�|s|jd�y|j|�y)NzData:r!rz500 Error: bad syntaxr�r@r,z500 Error: line too long�smtp_z&500 Error: command "%s" not recognizedz451 Internal confusionz552 Error: Too much mail data)�mail_options�rcpt_options�250 OK)#rI�joinrnr#r\r]rerdrir^rHr��find�upper�striprQr2r5�getattrr�rF�splitrJrKr�rMrmrWrfrgr�r�rC�process_messagerk)
r�line�sz�i�command�arg�max_sz�methodr��text�args�kwargs�statuss
             r�found_terminatorzSMTPChannel.found_terminatorCs���� � �%�%�d�&9�&9�:��
�g�t�D�z��4� ����?�?�d�l�l�*�!%�����B�����	�	�1�2���$�$��4��)���	�	�#��A��1�u��*�*�,�����r��(�.�.�*���1�Q�3�4�j�&�&�(���-�-��.�.�w�7�37�3J�3J�
��F�{��	�	�4�5���T�7�W�#4�d�;�F���	�	�B�W�L�M���3�K�����$�)�)�+��	�	�2�3�!"�����#�#�����9M�9M�(M��	�	�9�:�!"�����D��
�
�4�=�=�1�
&���D��G�t�|�|�3��K�K��Q�R��)��K�K��%�	
&�
"&���!3�!3�D�!9�D���I�I�t�}�}�d�l�l�D�<N�<N�O�D��F��$�$�$(�$5�$5�$(�$5�$5���6�T�%�%�5�5�t�F�v�F�F��%�%�'���	�	�(�#��	�	�&�!rc���|s|jd�y|jr|jd�y|j�||_|jd|jz�y)Nz501 Syntax: HELO hostname�503 Duplicate HELO/EHLOz250 %s)r^rPrOrU�rr�s  r�	smtp_HELOzSMTPChannel.smtp_HELO�sW����I�I�1�2������I�I�/�0������ ����	�	�(�T�Y�Y�&�'rc�&�|s|jd�y|jr|jd�y|j�||_d|_|jd|jz�|j
r5|jd|j
z�|jdxxdz
cc<|js|jd�|jr(|jd	�|jdxxd
z
cc<|jd�y)Nz501 Syntax: EHLO hostnamer�Tz250-%sz250-SIZE %s�MAIL�z250-8BITMIMEz250-SMTPUTF8�
z250 HELP)	r^rPrOrQrUrFr2rHrGr�s  r�	smtp_EHLOzSMTPChannel.smtp_EHLO�s�����I�I�1�2������I�I�/�0������ ���!����	�	�(�T�Y�Y�&�'�����I�I�m�d�&:�&:�:�;��$�$�V�,��2�,�� � ��I�I�n�%�����I�I�n�%��$�$�V�,��2�,��	�	�*�rc�N�|r|jd�y|jd�y)Nz501 Syntax: NOOPr��r^r�s  r�	smtp_NOOPzSMTPChannel.smtp_NOOP�s����I�I�(�)��I�I�h�rc�F�|jd�|j�y)Nz221 Bye)r^�close_when_doner�s  r�	smtp_QUITzSMTPChannel.smtp_QUIT�s���	�	�)�����rc�l�t|�}|d|j�|k(r||dj�Sy)Nr)r�r�r�)r�keywordr��keylens    r�_strip_command_keywordz"SMTPChannel._strip_command_keyword�s:���W����w��<����7�*��v�w�<�%�%�'�'�rc��|sy|j�jd�rt|�\}}nt|�\}}|s||fS|j|fS)N)rr�<)�lstrip�
startswithrr�	addr_spec)rr��address�rests    r�_getaddrzSMTPChannel._getaddr�sV�����:�:�<�"�"�3�'�*�3�/�M�G�T�)�#�.�M�G�T���D�=� �� � �$�&�&rc��i}|D]6}|jd�\}}}|j�r|r|sy|r|nd||<�8|S)N�=T)�	partition�isalnum)r�params�result�param�eqrvs      r�
_getparamszSMTPChannel._getparams�sQ�����	2�E�$���s�3��E�2�u��=�=�?�b���%'�E�T�F�5�M�		2�
�
rc�^�|�rd}|j�}|dk(r|jd�y|dk(r|jd�y|dk(r%d}|jr||z
}|j|�y|dk(r%d	}|jr||z
}|j|�y|d
k(r|jd�y|dk(r|jd
�y|dk(r|jd�y|dk(r|jd�y|dk(r|jd�y|jd�y|jd�y)N� [SP <mail-parameters>]�EHLOz250 Syntax: EHLO hostname�HELOz250 Syntax: HELO hostnamer�z 250 Syntax: MAIL FROM: <address>�RCPTz250 Syntax: RCPT TO: <address>r�z250 Syntax: DATA�RSETz250 Syntax: RSET�NOOPz250 Syntax: NOOP�QUITz250 Syntax: QUIT�VRFYz250 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 VRFY)r�r^rQ)rr��extended�lc_argrs     r�	smtp_HELPzSMTPChannel.smtp_HELP�s ���0�H��Y�Y�[�F�����	�	�5�6��6�!��	�	�5�6��6�!�8���%�%��8�O�C��	�	�#���6�!�6���%�%��8�O�C��	�	�#���6�!��	�	�,�-��6�!��	�	�,�-��6�!��	�	�,�-��6�!��	�	�,�-��6�!��	�	�6�7��	�	�5�6�
�I�I�,�
-rc��|r=|j|�\}}|r|jd�y|jd|z�y|jd�y)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY <address>)r�r^)rr�r�r�s    r�	smtp_VRFYzSMTPChannel.smtp_VRFY�sL���"�m�m�C�0�O�G�V���	�	�1�2��	�	�1�C�7�8��I�I�2�3rc���|js|jd�ytd|t��d}|jr|dz
}|�|j|�y|jd|�}|j
|�\}}|s|j|�y|js|r|j|�y|jr|jd�y|j�j�|_
|j|j�}|�|j|�y|js(|jdd	�}|d
vr|jd�y|jr4|jdd
�}|durd|_n|d
ur|jd�y|jdd�}|rX|j!�s|j|�y|j"r*t%|�|j"kDr|jd�yt'|j)��dkDr|jd�y||_td|jt��|jd�y)N�503 Error: send HELO firstz	===> MAILr!z 501 Syntax: MAIL FROM: <address>r�zFROM:z503 Error: nested MAIL command�BODY�7BIT)r��8BITMIMEz1501 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 sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:r�)rPr^r#r]rQr�r�rfr�r�r�r�rH�poprGrh�isdigitrF�intr��keys)rr��	syntaxerrr�r��body�smtputf8�sizes        r�	smtp_MAILzSMTPChannel.smtp_MAIL�s���!�!��I�I�2�3��
�k�3�[�1�6�	�����2�2�I��;��I�I�i� ���)�)�'�3�7���-�-��,������I�I�i� ���!�!�f��I�I�i� ���=�=��I�I�6�7��"�L�L�N�0�0�2�������!2�!2�3���>��I�I�i� ��� � ��:�:�f�f�-�D��/�/��	�	�M�N������z�z�*�e�4�H��4��(,��%���&��	�	�B�C���z�z�&�$�'����<�<�>��	�	�)�$���%�%�#�d�)�d�6J�6J�*J��	�	�V�W���v�{�{�}���!��I�I�R�S����
�
�i����[�9��	�	�(�rc�2�|js|jd�ytd|t��|js|jd�yd}|j
r|dz
}|�|j|�y|j
d|�}|j|�\}}|s|j|�y|j
s|r|j|�y|j�j�|_
|j|j�}|�|j|�yt|j��dkDr|jd	�y|jj|�td
|jt��|jd�y)Nr�z	===> RCPTr!z503 Error: need MAIL commandz501 Syntax: RCPT TO: <address>r�zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:r�)rPr^r#r]rfrQr�r�r�r�r�r�r�rrgr�)rr�rr�r�s     r�	smtp_RCPTzSMTPChannel.smtp_RCPT.sK���!�!��I�I�2�3��
�k�3�[�1��}�}��I�I�4�5��4�	�����2�2�I��;��I�I�i� ���)�)�%��5���-�-��,������I�I�i� ���!�!�f��I�I�i� ��"�L�L�N�0�0�2�������!2�!2�3���>��I�I�i� ���v�{�{�}���!��I�I�P�Q�������G�$�
�i����K�8��	�	�(�rc�n�|r|jd�y|j�|jd�y)Nz501 Syntax: RSETr�)r^rOr�s  r�	smtp_RSETzSMTPChannel.smtp_RSETQs-����I�I�(�)�������	�	�(�rc�
�|js|jd�y|js|jd�y|r|jd�y|j|_|jd�|jd�y)Nr�z503 Error: need RCPT commandz501 Syntax: DATAs
.
z#354 End data with <CR><LF>.<CR><LF>)rPr^rgr�rerjr�s  r�	smtp_DATAzSMTPChannel.smtp_DATAXsk���!�!��I�I�2�3���|�|��I�I�4�5����I�I�(�)���)�)������L�)��	�	�7�8rc�&�|jd�y)Nz502 EXPN not implementedr�r�s  r�	smtp_EXPNzSMTPChannel.smtp_EXPNgs���	�	�,�-r),rrrrdr�r5�collections�defaultdictr2�propertyr6�DATA_SIZE_DEFAULTrBrkrO�_SMTPChannel__server�setter�_SMTPChannel__line�_SMTPChannel__state�_SMTPChannel__greeting�_SMTPChannel__mailfrom�_SMTPChannel__rcpttos�_SMTPChannel__data�_SMTPChannel__fqdn�_SMTPChannel__peer�_SMTPChannel__conn�_SMTPChannel__addrr^r�r�r�r�r�r�r�r�r�r�r�rr
rrrrrrrrns����G��D���1�+�1�1�;M�2P�Q��
�+��+�<M��5�e�%:�N%�!�� �� ��_�_�!��!�
�#��#��]�]�$��$�
����
�^�^� �� �
�"��"����#��#�
����������
����������
�"��"��]�]�#��#�
�����]�]����
�����]�]����
�����]�]����
�����]�]����J�

-� ;"�|
(��, ��
�	'�	�!-�F	4�4�l!�F�9�.rrc�,�eZdZeZedddfd�Zd�Zd�Zy)r	NFc	�h�||_||_||_||_||_|r
|rtd��tjj||��	tj|dtji�}|j|dd|dd�|j�|j|�|jd�t!|j"j$�dt'j(t'j&���d|�d	|��t*�
�y#|j-��xYw)Nr:r8�typerr,�z started at z
	Local addr: z
	Remote addr:r!)�
_localaddr�_remoteaddrrFrGrHr4r�
dispatcherrBrS�getaddrinfo�SOCK_STREAM�
create_socket�set_reuse_addr�bind�listenr#�	__class__r�time�ctimer]rY)r�	localaddr�
remoteaddrrFr9rGra�gai_resultss        rrBzSMTPServer.__init__os��$���%���.���.���'����{��@�A�
A����$�$�T�s�$�3�	:� �,�,�i�F�28�2D�2D�F�K����{�1�~�a�0�+�a�.��2C�D����!��I�I�i� ��K�K��N�

����'�'����D�I�I�K�)@��:�'�-8�
:��		��J�J�L��s
�A3D�D1c	��tdt|�zt��|j||||j|j
|j|j�}y)NzIncoming connection from %sr!)r#r\r]�
channel_classrF�_maprGrH)rrDrE�channels    r�handle_acceptedzSMTPServer.handle_accepted�sP��
�+�d�4�j�8�{�K��$�$�T�%)�%)�%)�%9�%9�%)�Y�Y�%)�%9�%9�%)�%6�%6�
8�rc��t�)aOverride 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�rrWrfrgr�r�s      rr�zSMTPServer.process_message�s
��>"�!r)	rrrrr5rrBr8r�rrrr	r	ks"���M�"3��!&�E�:�88�"rr	c��eZdZd�Zd�Zy)r
c��d}|j�}|D]k}|rA|s?d|dz}t|t�st|j	d��}t|�d}t|t�st|�}t|��my)Nr,zX-Peer: rr�)�
splitlines�
isinstancer�r\�encoder#)rrWr��	inheaders�linesr��
peerheaders       r�_print_message_contentz&DebuggingServer._print_message_content�s{���	����!���	�D���'�$�q�'�1�
�!�$��,�!%�j�&7�&7��&@�!A�J��j�!��	��d�C�(��D�z���$�K�	rc���td�|rD|jd�rtd|dz�|jd�rtd|dz�|j||�td�y)Nz%---------- MESSAGE FOLLOWS ----------r�zmail options: %sr�zrcpt options: %s
z%------------ END MESSAGE ------------)r#�getrDr;s      rr�zDebuggingServer.process_message�se��
�5�6���z�z�.�)��(�6�.�+A�A�B��z�z�.�)��*�V�N�-C�C�D��#�#�D�$�/�
�5�6rN)rrrrDr�rrrr
r
�s���"7rr
c�*��eZdZ�fd�Zd�Zd�Z�xZS)rc�T��d|vr|drtd��tt|�|i|��y)NrGz$PureProxy does not support SMTPUTF8.)r4�superrrB)rr�r�r.s   �rrBzPureProxy.__init__�s3�����&�6�2C�+D��C�D�D�
�i��'��8��8rc���|jd�}d}|D]}|sn|dz
}�
|j|d|dz�tj|�}|j	|||�}td|t��y)Nrrr,z
X-Peer: %szwe got some refusals:r!)r��insertrLr��_deliverr#r])	rrWrfrgr�rBr�r��refuseds	         rr�zPureProxy.process_message�sy���
�
�4� ��
���	�D���
��F�A�	�	���Q��t�A�w�.�/��|�|�E�"���-�-��'�4�8��
�%�w�[�Arc�6�ddl}i}	|j�}|j|jd|jd�	|j	|||�}|j�|S#|j�wxYw#|j$r(}tdt��|j}Yd}~|Sd}~wt|jf$rO}td|jt��t|dd�}t|dd	�}	|D]	}
||	f||
<�Yd}~|Sd}~wwxYw)
Nrr,zgot SMTPRecipientsRefusedr!�got�	smtp_code����
smtp_error�ignore)�smtplib�SMTP�connectr&�sendmail�quit�SMTPRecipientsRefusedr#r]�
recipientsrX�
SMTPExceptionr.r�)rrfrgr�rTrM�s�e�errcode�errmsg�rs           rrLzPureProxy._deliver�s�����	/�����A�
�I�I�d�&�&�q�)�4�+;�+;�A�+>�?�
��*�*�X�w��=���������������,�,�	#��-�K�@��l�l�G������.�.�/�	/��%����;�7��a��b�1�G��Q��h�7�F��
/��%�v�.���
�
/����	/�s<�<A?�A*�A?�*A<�<A?�?D�B1�1D�	AD�D)rrrrBr�rL�
__classcell__)r.s@rrr�s���9�
B�rrc��eZdZdZdZdZdZy)�OptionsTrNF)rrr�setuid�	classname�
size_limitrGrrrrcrcs��
�F��I��J��Orrcc���	tjtjdddgd��\}}t�}D]�\}}|dvrt	d��|dvr%t
t�tjd��?|dvrd|_	�K|d	vr||_
�W|d
vrtja�l|dvrd|_
�x|d
vs�}	t|�}||_��t!�dkrd}d}nQt!|�dkr|d}d}n;t!|�dkr|d}|d}n"t	ddt"j%|�z�j'd�}	|	dkrt	dd|z�|d|	|_	t||	dzd�|_j'd�}	|	dkrt	dd|z�|d|	|_	t||	dzd�|_|S#tj$r}t	d|�Yd}~���d}~wwxYw#t
d|ztj��tjd�Y���xYw#t,$rt	dd|z�Y��wxYw#t,$rt	dd|z�Y|SwxYw)Nr,z	nVhc:s:du)zclass=�nosetuid�version�helpzsize=�debugr)z-hz--helpr)z-Vz	--version)z-nz
--nosetuidF)z-cz--class)z-dz--debug)z-uz
--smtputf8T)z-sz--sizezInvalid size: r!zlocalhost:8025zlocalhost:25rp�zInvalid arguments: %s�:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)�getoptr&�argv�errorr*rcr#r_r(rdrer'r]rGrrfr��
COMMASPACEr�r��	localhost�	localportr4�
remotehost�
remoteport)
�optsr�r]�options�optr��int_size�	localspec�
remotespecr�s
          r�	parseargsr|
st����]�]��H�H�Q�R�L�+�
��
��d��i�G�����S��"�"��!�H�
�'�
'��+���H�H�Q�K�
�(�
(�"�G�N�
�%�
%� #�G��
�%�
%��*�*�K�
�(�
(�&*�G�#�
�$�
$�
��s�8��%-��"�#�.�4�y�1�}�$�	�#�
�	�T��Q����G�	�#�
�	�T��Q����G�	��!�W�
�
�a�(�:�?�?�4�+@�@�A�	���s��A��1�u�
�a�%�	�1�2�!�"�1�
�G��3��	�!�A�#�$��0���	�����A��1�u�
�a�&��3�4�#�B�Q��G��5� ��A�a�C�D�!1�2����N��q�<�<��
�a�������,
��&��,�3�:�:�>�������,�3�
�a�%�	�1�2�3���5�
�a�&��3�4��N�5�sG�-F?�9G,�!H'�'I�?G)�G$�$G)�,5H$�'I�I�I!� I!�__main__r<r,)rGz7Cannot import module "pwd"; try running with -n option.r!�nobodyrpz3Cannot setuid "nobody"; try running with -n option.)r)@r$r&�osrZrnr/rSr�test.supportrr�warningsr�email._header_value_parserrr�__all__ro�programr_r
r]rLrqrr*rArr'r	r
rrcr|rrwre�rfind�lastdot�
__import__r%�locals�modr}r��class_rrrsrtrurfrG�proxyrd�pwd�ImportErrorr#r'r(�getpwnamr~�PermissionError�loop�KeyboardInterruptrrr�<module>r�s1��+�N�	��
��
��+��D����(�(�1�+��-����
�i��
��
�
����z.�(�%�%�z.�zJ"��$�$�J"�Z7�j�7�<*�
�*�Z��?�D�z���k�G��!�!�I�
�i���/�/�#�&����8�G�,�g�i���B�4�H���g�a�i�j�)�	��
�S�)�
$�F��G�%�%�w�'8�'8�9��&�&��(:�(:�;��%�%�w�7N�7N�
P�E��~�~�	������h�'��*��	��B�I�I�f��
���
�
��7��"�	��K�RU�R\�R\�]��C�H�H�Q�K�	���	��G�c�j�j�Y��C�H�H�Q�K�	��
�
��
�s6�'F'�G�H	�'+G�G�+H�H�	H�H

Zerion Mini Shell 1.0