Hacked By AnonymousFox

Current Path : /opt/alt/python27/lib/python2.7/site-packages/raven/utils/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/raven/utils/ssl_match_hostname.pyc

�
��Yc@@sWdZddlmZddlZdZdefd��YZdd�Zd	�ZdS(
sHThe match_hostname() function from Python 3.2, essential when using SSL.i(tabsolute_importNs3.2.2tCertificateErrorcB@seZRS((t__name__t
__module__(((sO/opt/alt/python27/lib/python2.7/site-packages/raven/utils/ssl_match_hostname.pyR
sic	C@sLg}|stS|jd�}|d}|jd�}||kr]tdt|���n|sy|j�|j�kS|dkr�|jd�nY|jd�s�|jd�r�|jtj	|��n"|jtj	|�j
dd��x(|d	D]}|jtj	|��q�Wtjd
dj|�dtj
�}|j|�S(
shMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    t.it*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*is\As\.s\Z(tFalsetsplittcountRtreprtlowertappendt
startswithtretescapetreplacetcompiletjoint
IGNORECASEtmatch(	tdnthostnamet
max_wildcardstpatstpartstleftmostt	wildcardstfragtpat((sO/opt/alt/python27/lib/python2.7/site-packages/raven/utils/ssl_match_hostname.pyt_dnsname_matchs(
"&cC@s[|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
ValueErrortgetRRtlenRRtmapR	(tcertRtdnsnamestsantkeytvaluetsub((sO/opt/alt/python27/lib/python2.7/site-packages/raven/utils/ssl_match_hostname.pytmatch_hostname@s2%(	t__doc__t
__future__RR
t__version__R"RRR,(((sO/opt/alt/python27/lib/python2.7/site-packages/raven/utils/ssl_match_hostname.pyt<module>s2

Hacked By AnonymousFox1.0, Coded By AnonymousFox