HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/twisted/protocols/__pycache__/postfix.cpython-38.pyc
U

��W[q�@sdZddlZzddlmZWn ek
r<ddlmZYnXzddlmZmZ	Wn$ek
rvddl
mZmZ	YnXddlmZddlm
Z
ddlmZmZddlmZdd	lmZd
d�Zdd
�ZGdd�deje
j�ZGdd�deej�ZGdd�dej�ZdS)z1
Postfix mail transport agent related protocols.
�N)�UserDict)�quote�unquote)�basic)�policies)�protocol�defer)�log)�unicodecCs t|�}t|t�r|�d�}|S�N�ascii)�_quote�
isinstancer
�encode��sZquoted�r�;/usr/lib/python3/dist-packages/twisted/protocols/postfix.pyr s

rcCs&t|t�r|�d�}t|�}|�d�Sr)r�bytes�decode�_unquoterrrrrr(s

rc@sReZdZdZdZdZdd�Zddd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�PostfixTCPMapServera
    Postfix mail transport agent TCP map protocol implementation.

    Receive requests for data matching given key via lineReceived,
    asks it's factory for the data with self.factory.get(key), and
    returns the data to the requester. None means no entry found.

    You can use postfix's postmap to test the map service::

    /usr/sbin/postmap -q KEY tcp:localhost:4242

    iX�
cCs|�|j�dS�N)Z
setTimeout�timeout)�selfrrr�connectionMadeAsz"PostfixTCPMapServer.connectionMade�cCs |�t|��d�d|�dS)z8
        Send an SMTP-like code with a message.
        r� N)ZsendLine�strr)r�code�messagerrr�sendCodeFszPostfixTCPMapServer.sendCodecCs�|��z|�dd�\}}Wntk
r8|}d}YnXzt|d|�d��}Wn tk
rr|�dd�YnJXz||�Wn:tt�	�d��
d�}|�dd|d|�YnXdS)N�Zdo_r�sunknown commandsCommand s	 failed: )ZresetTimeout�split�
ValueError�getattrr�AttributeErrorr"r�sys�exc_infor)r�lineZrequestZparams�fZexcInforrr�lineReceivedNs"
�z PostfixTCPMapServer.lineReceivedcCsF|dkr|�dd�n,t�|jj|�}|�|j|j�|�t	j
�dS)Nr$s!Command 'get' takes 1 parameters.)r"rZ
maybeDeferred�factory�getZaddCallbacks�_cbGot�_cbNotZ
addErrbackr	�err)r�key�drrr�do_getcs
zPostfixTCPMapServer.do_getcCs|���d�}|�d|�dS)Nrr$)ZgetErrorMessagerr")rZfail�msgrrrr1mszPostfixTCPMapServer._cbNotcCs(|dkr|�d�n|�dt|��dS)N����)r"r)r�valuerrrr0sszPostfixTCPMapServer._cbGotcCs\|dkr|�dd�nBz|�dd�\}}Wn tk
rJ|�dd�YnX|�dd�dS)Nr$s!Command 'put' takes 2 parameters.r#r7sput is not implemented yet.)r"r%r&)rZkeyAndValuer3r9rrr�do_put{szPostfixTCPMapServer.do_putN)r)
�__name__�
__module__�__qualname__�__doc__rZ	delimiterrr"r-r5r1r0r:rrrrr0s


rc@seZdZdZeZdS)�PostfixTCPMapDictServerFactory�B
    An in-memory dictionary factory for PostfixTCPMapServer.
    N)r;r<r=r>rrrrrrr?�sr?c@s&eZdZdZeZddd�Zdd�ZdS)�'PostfixTCPMapDeferringDictServerFactoryr@NcCsi|_|dk	r|j�|�dSr)�data�update)rrBrrr�__init__�sz0PostfixTCPMapDeferringDictServerFactory.__init__cCst�|j�|��Sr)rZsucceedrBr/)rr3rrrr/�sz+PostfixTCPMapDeferringDictServerFactory.get)N)r;r<r=r>rrrDr/rrrrrA�s
rA)r>r)r�ImportError�collectionsZurllibrr
rrZurllib.parseZtwisted.protocolsrrZtwisted.internetrrZtwisted.pythonr	Ztwisted.python.compatr
ZLineReceiverZTimeoutMixinrZ
ServerFactoryr?rArrrr�<module>s&X