ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/rhn/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/self/root/lib/python2.7/site-packages/rhn/SSL.pyo

�
���[c@s�dZddlmZddlmZddlZddlZddlZddlZdZdfd��YZ	d�Z
d	ejejfd
��YZ
dS(sK
rhn.SSL builds an abstraction on top of the objects provided by pyOpenSSL
i����(tSSL(tcryptoNixt	SSLSocketcBs�eZdZdd�Zd�Zd�Zdd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zdd
�Zd�Zd�Zd�ZeZeZdd�ZRS(sM
    Class that wraps a pyOpenSSL Connection object, adding more methods
    cCs�d|_d|_||_g|_|p-g}x|D]}|j|�q7Wtj|_tj	|_
d|_d|_d|_
d|_d|_dS(Ni it(tNonet_ctxt_connectiont_sockt_trusted_certstadd_trusted_certRt
SSLv23_METHODt_ssl_methodtVERIFY_PEERt_ssl_verify_flagst_buffer_sizet_post_buffert_makefile_calledt_closed(tselftsockett
trusted_certstf((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyt__init__+s				
				cCs9tj|tj�s%td|�n|jj|�dS(sh
        Adds a trusted certificate to the certificate store of the SSL context
        object.
        s"Unable to read certificate file %sN(tostaccesstR_OKt
ValueErrorRtappend(Rtfile((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR	HscCs�|j�tj|j�|_|jjtj�|jjtj�|jrux-|jD]}|jj	|�qXWn	d|_
|jj|j
t�t
td�r�|jjtj�ntj|j|j�|_|jj�dS(s1
        Initializes the SSL connection.
        itOP_DONT_INSERT_EMPTY_FRAGMENTSN(t
_check_closedRtContextRRtset_optionstOP_NO_SSLv2tOP_NO_SSLv3Rtload_verify_locationsR
t
set_verifytssl_verify_callbackthasattrRt
ConnectionRRtset_connect_state(RR((s+/usr/lib/python2.7/site-packages/rhn/SSL.pytinit_sslQs
		cCs&|r||_n|jd|_|S(sG
        Returns self, since we are a file-like object already
        i(RR(Rtmodetbufsize((s+/usr/lib/python2.7/site-packages/rhn/SSL.pytmakefileoscCs8|jr
dS|js$|j�dS|jd|_dS(s+
        Closes the SSL connection
        Ni(RRt
_really_close(R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pytclose|s		
cCs�|jdkrdStjddkrN|jj�dkrs|jj�qsn%|jj�dkrs|jj�n|jj�d|_dS(Niis%SSL negotiation finished successfullyi(	RRtsystversion_infotget_state_stringtshutdowntstate_stringR/R(R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR.�s
cCs|jrtd�ndS(NsI/O operation on closed file(RR(R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR�s	cCs/t|j|�r"t|j|�St|�dS(N(R'RtgetattrtAttributeError(Rtname((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyt__getattr__�scCsdS(s'
        Returns false always.
        i((R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pytisatty�scCs|jS(N(R(R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyttell�sicCs
td�dS(Ntseek(tNotImplementedError(RtposR+((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR;�scCs�|j�|j}t|j�}x||ks=|dkr<|dk	r_t|||�}nyT|jj|�}|j||_t|j�}|jj�}|dkr�PnWq%t	j
k
r�Pq%t	jk
r�}dG|jGHPq%t	j
k
r|jtjd�q%t	jk
r8|jtjd�q%Xq%W|rc|j| }|j||_n|j}d|_|jt|�|_|S(s@
        Reads up to amt bytes from the SSL connection.
        is
SSL exceptiontreadRN(RRtlenRRtminRtrecvtpendingRtZeroReturnErrortSysCallErrortargstWantWriteErrort_polltselecttPOLLOUTt
WantReadErrortPOLLINR(Rtamttbuffer_sizet
buffer_lengthtdataRBtetret((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR>�s:
	
		cCs[tj�}|j|j|�|j|jj�d�}|gkrWtd|�ndS(Ni�sConnection timed out on %s(RHtpolltregisterRt
gettimeouttTimeoutException(Rtfilter_typetcaller_nametpollertres((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyRG�s
cCs�|j�t|�}x�tr�y6|jj|�}|t|�krJPn||}Wqtjk
r~|jtj	d�qtj
k
r�|jtjd�qXqW|S(s/
        Writes to the SSL connection.
        twrite(RR?tTrueRtsendRRFRGRHRIRJRK(RROtoriglentsent((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyRZ�s
	cCs
|j|�S(N(R>(RRL((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyRAscCs�|j�x]trid}|jjd�}|dkrD|d}n$|rht|j�|krh|}n|dk	r�|j| }|j||_|jt|�|_|S|j}|r�t|j|t|j��}ny&|j	j
|�}|j||_Wq
tjk
rPq
tj
k
r?|jtjd�q
tjk
re|jtjd�q
Xq
W|j}d|_|jt|�|_|S(sg
        Reads a single line (up to `length' characters long) from the SSL
        connection.
        s
iitreadlineRN(RR[RRtfindR?RRR@RRARRCRFRGRHRIRJRK(Rtlengtht	charcounttiRQR,RO((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR_s:
	
	
	"		N(t__name__t
__module__t__doc__RRR	R*R-R/R.RR8R9R:R;R>RGRZRAR\tsendallR_(((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR's&			
						2			cCs|S(sb
    Verify callback, which will be called for each certificate in the
    certificate chain.
    ((tconntcertterrnumtdepthtok((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyR&7sRUcBseZd�Zd�ZRS(cGs
||_dS(N(RE(RRE((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyRAscCsdS(NsTimeout Exception((R((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyt__str__Ds(RdReRRm(((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyRU?s	(RftOpenSSLRRRR0RRHtDEFAULT_TIMEOUTRR&tErrorttimeoutRU(((s+/usr/lib/python2.7/site-packages/rhn/SSL.pyt<module>s�	

Zerion Mini Shell 1.0