ok

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/setuptools/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyc

�
0��`c@sddlZddlZddlZddlZddlmZmZmZddlZddlm	Z	m
Z
yddlZWnek
r�dZnXdddddgZd	j�j�ZyejjZejZWnek
r�eZZnXedk	oeeefkZydd
lmZmZWnUek
r�y$ddlmZddlmZWq�ek
r�dZdZq�XnXes�d
efd��YZnes�dd�Zd�Zndefd��YZdefd��YZdd�Zda d�Z!d�Z"dS(i����N(turllibthttp_clienttmap(tResolutionErrortExtractionErrortVerifyingHTTPSHandlertfind_ca_bundletis_availablet
cert_pathst
opener_fors�
/etc/pki/tls/certs/ca-bundle.crt
/etc/ssl/certs/ca-certificates.crt
/usr/share/ssl/certs/ca-bundle.crt
/usr/local/share/certs/ca-root.crt
/etc/ssl/cert.pem
/System/Library/OpenSSL/certs/cert.pem
/usr/local/share/certs/ca-root-nss.crt
(tCertificateErrortmatch_hostname(R
(RR
cBseZRS((t__name__t
__module__(((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR
4sic
CsRg}|stS|jd�}|d}|d}|jd�}||krgtdt|���n|s�|j�|j�kS|dkr�|jd�nY|jd�s�|jd�r�|jtj	|��n"|jtj	|�j
dd	��x$|D]}|jtj	|��q�Wtjd
dj|�dtj
�}	|	j|�S(
spMatching according to RFC 6125, section 6.4.3

        http://tools.ietf.org/html/rfc6125#section-6.4.3
        t.iit*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*s\As\.s\Z(tFalsetsplittcountR
treprtlowertappendt
startswithtretescapetreplacetcompiletjoint
IGNORECASEtmatch(
tdnthostnamet
max_wildcardstpatstpartstleftmostt	remaindert	wildcardstfragtpat((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyt_dnsname_match8s*

"
&cCs[|std��ng}|jdd
�}xC|D];\}}|dkr4t||�r_dS|j|�q4q4W|s�xc|jdd�D]L}xC|D];\}}|dkr�t||�r�dS|j|�q�q�Wq�Wnt|�dkrtd|d	jtt|��f��n;t|�dkrKtd
||df��ntd��dS(s=Verify that *cert* (in decoded format as returned by
        SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
        rules are followed, but IP addresses are not accepted for *hostname*.

        CertificateError is raised on failure. On success, the function
        returns nothing.
        sempty or no certificatetsubjectAltNametDNSNtsubjectt
commonNameis&hostname %r doesn't match either of %ss, shostname %r doesn't match %ris=no appropriate commonName or subjectAltName fields were found(((	t
ValueErrortgetR(RtlenR
RRR(tcertRtdnsnamestsantkeytvaluetsub((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyRls.%cBs eZdZd�Zd�ZRS(s=Simple verifying handler: no auth, subclasses, timeouts, etc.cCs||_tj|�dS(N(t	ca_bundletHTTPSHandlert__init__(tselfR6((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR8�s	cs�j�fd�|�S(Ncst|�j|�S(N(tVerifyingHTTPSConnR6(thosttkw(R9(sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyt<lambda>�t(tdo_open(R9treq((R9sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyt
https_open�s(RR
t__doc__R8RA(((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR�s	R:cBs eZdZd�Zd�ZRS(s@Simple verifying connection: no auth, subclasses, timeouts, etc.cKs tj|||�||_dS(N(tHTTPSConnectionR8R6(R9R;R6R<((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR8�scCs�tj|j|jft|dd��}t|d�rjt|dd�rj||_|j�|j	}n	|j}t
j|dt
jd|j
�|_yt|jj�|�Wn4tk
r�|jjtj�|jj��nXdS(Ntsource_addresst_tunnelt_tunnel_hostt	cert_reqstca_certs(tsockettcreate_connectionR;tporttgetattrtNonethasattrtsockRERFtssltwrap_sockett
CERT_REQUIREDR6RtgetpeercertR
tshutdownt	SHUT_RDWRtclose(R9ROtactual_host((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pytconnect�s$!	
	

(RR
RBR8RX(((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR:�s	cCs"tjjt|pt���jS(s@Get a urlopen() replacement that uses ca_bundle for verification(Rtrequesttbuild_openerRRtopen(R6((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR	�s	cswtdk	rtjSyddlm�Wntk
r;dSXd�f��fd��Y��dddg�atjS(Ni����(tCertFilet
MyCertFilecs,eZdd�fd�Z�fd�ZRS(csL�j|�x|D]}|j|�qW|j|�tj|j�dS(N(R8taddstoretaddcertstatexittregisterRV(R9tstorestcertststore(R\(sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR8�s



cs/yt�|�j�Wntk
r*nXdS(N(tsuperRVtOSError(R9(R](sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyRV�s
(((RR
R8RV((R\R](sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR]�sRbtCAtROOT(t	_wincertsRMtnametwincertstoreR\tImportError(((R\R]sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pytget_win_certfile�s
cCsstjdkrt�Sx$tD]}tjj|�r|SqWytjdd�SWntt	t
fk
rndSXdS(s*Return an existing CA bundle path, or Nonetnttcertifis
cacert.pemN(tosRjRmRtpathtisfilet
pkg_resourcestresource_filenameRlRRRM(t	cert_path((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyR�s
(#RpRIR`Rtsetuptools.extern.six.movesRRRRsRRRPRlRMt__all__tstripRRRYR7RCtAttributeErrortobjectRR
Rtbackports.ssl_match_hostnameR-R(RR:R	RiRmR(((sG/opt/alt/python27/lib/python2.7/site-packages/setuptools/ssl_support.pyt<module>sN

	



4)
!	

Zerion Mini Shell 1.0