a �DOg^;�@sfddlZddlZddlZddlZzddlZdZWneyFdZYn0ddgZGdd�de�Z dZ dZ d Z d Z e e Zd ZGd d�d�Zer�Gd d�de�Ze�d�edk�rbddlZeejd�Zee���e�ejd�e�ejd�e��e��\ZZeded�D]BZe� e�\Z!Z"Z#ede�e"D]Z$ede$��q:ed��qe�%�dS)�NTF�POP3� error_protoc@s eZdZdS)rN)�__name__� __module__� __qualname__�rr�/usr/lib64/python3.9/poplib.pyr��ni�� � ic@seZdZdZeejfdd�Zdd�Zdd�Z dd �Z d d �Z d d �Z dd�Z dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd:d;�Z%dS)?rzUTF-8cCsP||_||_d|_t�d|||�|�|�|_|j�d�|_d|_ |� �|_ dS)NFzpoplib.connect�rbr) �host�port�_tls_established�sys�audit�_create_socket�sock�makefile�file� _debugging�_getresp�welcome)�selfrr�timeoutrrr�__init__bs z POP3.__init__cCs(|dur|std��t�|j|jf|�S)Nz0Non-blocking socket (timeout=0) is not supported)� ValueError�socket�create_connectionrr)rrrrrrms zPOP3._create_socketcCs:|jdkrtdt|��t�d||�|j�|t�dS)N�z*put*zpoplib.putline)r�print�reprrrr�sendall�CRLF�r�linerrr�_putlinersz POP3._putlinecCs.|jrtdt|��t||j�}|�|�dS)Nz*cmd*)rr!r"�bytes�encodingr'r%rrr�_putcmdzs z POP3._putcmdcCs�|j�td�}t|�tkr$td��|jdkrrrr�noopsz POP3.noopcCs |�d�S)NZRSETrBr>rrr�rsetsz POP3.rsetcCs|�d�}|��|S)NZQUIT)r<�close)rr5rrr�quits z POP3.quitcCs,z�|j}d|_|dur|��W|j}d|_|dur�z`z|�tj�WnBty�}z*|jtjkrtt |dd�dkrt�WYd}~n d}~00W|��n |��0n�|j}d|_|du�r&zbz|�tj�WnDt�y}z*|jtjkr�t |dd�dkr��WYd}~n d}~00W|��n |��00dS)N�winerrorri&') rrSr�shutdownr� SHUT_RDWR�OSError�errnoZENOTCONN�getattr)rrr�excrrrrSs6  ��  �z POP3.closecCs|�d|�S)NzRPOP %srBrCrrr�rpop7sz POP3.rpops\+OK.[^<]*(<.*>)cCs\t||j�}|j�|j�}|s&td��ddl}|�d�|}|�|�� �}|� d||f�S)Nz!-ERR APOP not supported by serverrr z APOP %s %s) r(r)� timestamp�matchrr�hashlib�group�md5� hexdigestr<)rrD�passwordZsecret�mr_�digestrrr�apop>s z POP3.apopcCs|�d||f�S)Nz TOP %s %srN)rrMZhowmuchrrr�topSszPOP3.topcCs |dur|�d|�S|�d�S)NzUIDL %sZUIDLrKrLrrr�uidl\sz POP3.uidlcCs |�d�S)NZUTF8rBr>rrr�utf8hsz POP3.utf8cCs`dd�}i}z4|�d�}|d}|D]}||�\}}|||<q$WntyZtd��Yn0|S)NcSs"|�d���}|d|dd�fS)N�asciirr )�decoderG)r&Zlstrrr� _parsecap{szPOP3.capa.._parsecapZCAPAr z!-ERR CAPA not supported by server)r=r)rrl�capsr5ZrawcapsZcaplineZcapnmZcapargsrrr�capans    z POP3.capacCsxts td��|jrtd��|��}d|vr2td��|durBt��}|�d�}|j|j|j d�|_|j� d�|_ d|_|S)Nz-ERR TLS support missing�$-ERR TLS session already establishedZSTLSz!-ERR STLS not supported by server�Zserver_hostnamer T) �HAVE_SSLrrrn�ssl�_create_stdlib_contextr<� wrap_socketrrrr)r�contextrmr5rrr�stls�s  �z POP3.stls)N)N)N)&rrrr)� POP3_PORTr�_GLOBAL_DEFAULT_TIMEOUTrrr'r*r2rr:r<r=r?rArDrErIr9rOrPrQrRrTrSr\�re�compiler]rfrgrhrirnrvrrrrr3s@-�       c@s4eZdZeddejdfdd�Zdd�Zddd�ZdS) �POP3_SSLNcCs�|dur|durtd��|dur0|dur0td��|dus@|durVddl}|�dtd�||_||_|durxtj||d�}||_t � ||||�dS)Nz4context and keyfile arguments are mutually exclusivez5context and certfile arguments are mutually exclusiverzAkeyfile and certfile are deprecated, use a custom context insteadrF)�certfile�keyfile) r�warnings�warn�DeprecationWarningr}r|rrrsrurr)rrrr}r|rrur~rrrr�s"��zPOP3_SSL.__init__cCs"t�||�}|jj||jd�}|S)Nrp)rrrurtr)rrrrrrr�s  �zPOP3_SSL._create_socketcCs td��dS)Nro)r)rr}r|rurrrrv�sz POP3_SSL.stls)NNN) rrr� POP3_SSL_PORTrrxrrrvrrrrr{�s � r{�__main__r rF�z Message %d:z z-----------------------)&rYryrrrrrq� ImportError�__all__� Exceptionrrwr�r0ZLFr$r.rr{r8r�argv�ar!r?rDrEr9rIZnumMsgsZ totalSize�range�irO�header�msgr1r&rTrrrr�sJ  p0