Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/setuptools/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/setuptools/ssl_support.pyo

�
�fc@s/ddlZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZmZyddl
Z
Wnek
r�dZ
nXdddddgZd	j�j�ZyejjZejZWnek
r�eZZnXe
dk	oeeefkZydd
l
mZmZWnUek
r�y$ddlmZddlmZWq�ek
r�dZdZq�XnXes�d
efd��YZnes�dd�Zd�Zndefd��YZdefd��YZ dd�Z!d�Z"e"d��Z#d�Z$d�Z%dS(i����N(turllibthttp_clienttmaptfilter(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
/etc/ssl/ca-bundle.pem
(tCertificateErrortmatch_hostname(R(RRcBseZRS((t__name__t
__module__(((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR5sic
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(tFalsetsplittcountRtreprtlowertappendt
startswithtretescapetreplacetcompiletjoint
IGNORECASEtmatch(
tdnthostnamet
max_wildcardstpatstpartstleftmostt	remaindert	wildcardstfragtpat((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyt_dnsname_match;s*

"
&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)RtlenRRRR(tcertR tdnsnamestsantkeytvaluetsub((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyRos.%cBs eZdZd�Zd�ZRS(s=Simple verifying handler: no auth, subclasses, timeouts, etc.cCs||_tj|�dS(N(t	ca_bundletHTTPSHandlert__init__(tselfR7((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR9�s	cs�j�fd�|�S(Ncst|�j|�S(N(tVerifyingHTTPSConnR7(thosttkw(R:(s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyt<lambda>�t(tdo_open(R:treq((R:s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyt
https_open�s(R
Rt__doc__R9RB(((s:/usr/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(tHTTPSConnectionR9R7(R:R<R7R=((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR9�scCs+tj|j|jft|dd��}t|d�rjt|dd�rj||_|j�|j	}n	|j}tt
d�r�t
jd|j�}|j
|d|�|_n$t
j
|dt
jd|j�|_yt|jj�|�Wn4tk
r&|jjtj�|jj��nXdS(	Ntsource_addresst_tunnelt_tunnel_hosttcreate_default_contexttcafiletserver_hostnamet	cert_reqstca_certs(tsockettcreate_connectionR<tporttgetattrtNonethasattrtsockRFRGtsslRHR7twrap_sockett
CERT_REQUIREDRtgetpeercertRtshutdownt	SHUT_RDWRtclose(R:RStactual_hosttctx((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pytconnect�s$$!	
	

(R
RRCR9R](((s:/usr/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(R7((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR
�s	cs"tj���fd��}|S(Ncs+t�d�s$�||��_n�jS(Ntalways_returns(RRRa(targstkwargs(tfunc(s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pytwrapper�s(t	functoolstwraps(RdRe((Rds:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pytonce�scsnyddl}Wntk
r$dSXd|jf�fd��Y���}|jd�|jd�|jS(Ni����tCertFilecs&eZ�fd�Z�fd�ZRS(cs't�|�j�tj|j�dS(N(tsuperR9tatexittregisterRZ(R:(Ri(s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR9�scs/yt�|�j�Wntk
r*nXdS(N(RjRZtOSError(R:(Ri(s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyRZ�s
(R
RR9RZ((Ri(s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyRi�stCAtROOT(twincertstoretImportErrorRQRitaddstoretname(Rpt	_wincerts((Ris:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pytget_win_certfile�s
	

cCs4ttjjt�}t�p3t|d�p3t�S(s*Return an existing CA bundle path, or NoneN(	RtostpathtisfileR	RutnextRQt_certifi_where(textant_cert_paths((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyR�s	cCs5ytd�j�SWntttfk
r0nXdS(Ntcertifi(t
__import__twhereRqRR(((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyRzs(&RvRMRkRRftsetuptools.extern.six.movesRRRRt
pkg_resourcesRRRTRqRQt__all__tstripRR	R^R8RDtAttributeErrortobjectRRRtbackports.ssl_match_hostnameR.R)RR;R
RhRuRRz(((s:/usr/lib/python2.7/site-packages/setuptools/ssl_support.pyt<module>sP"

	



4)
(			

Hacked By AnonymousFox1.0, Coded By AnonymousFox