Your IP : 18.221.217.100


Current Path : /opt/alt/python35/lib/python3.5/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib/python3.5/site-packages/setuptools/__pycache__/ssl_support.cpython-35.pyc



�Re �"@sBddlZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZmZyddl
Z
Wnek
r�dZ
YnXdddddgZd	j�j�ZyejjZejZWnek
r�eZZYnXe
dk	oeeefkZydd
l
mZmZWnWek
r�y$ddlmZddlmZWnek
r�dZdZYnXYnXes�Gd
d�de�Zes�ddd�Zdd�ZGdd�de�ZGdd�de�Zddd�Z dd�Z!e!dd��Z"dd�Z#dd�Z$dS)�N)�urllib�http_client�map�filter)�ResolutionError�ExtractionError�VerifyingHTTPSHandler�find_ca_bundle�is_available�
cert_paths�
opener_fora
/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
)�CertificateError�match_hostname)r
)rc@seZdZdS)r
N)�__name__�
__module__�__qualname__�rr��/builddir/build/BUILDROOT/alt-python35-setuptools-36.3.0-4.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/setuptools/ssl_support.pyr
5sr
�c
CsUg}|sdS|jd�}|d}|dd�}|jd�}||krjtdt|���|s�|j�|j�kS|dkr�|jd�nY|jd	�s�|jd	�r�|jtj|��n"|jtj|�j	d
d��x$|D]}|jtj|��qWtj
dd
j|�dtj�}	|	j
|�S)zpMatching according to RFC 6125, section 6.4.3

        http://tools.ietf.org/html/rfc6125#section-6.4.3
        F�.rrN�*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)�split�countr
�repr�lower�append�
startswith�re�escape�replace�compile�join�
IGNORECASE�match)
�dn�hostname�
max_wildcards�pats�parts�leftmost�	remainder�	wildcards�frag�patrrr�_dnsname_match;s*
"
&r.cCsO|std��g}|jdf�}x@|D]8\}}|dkr1t||�r\dS|j|�q1W|s�x]|jdf�D]I}x@|D]8\}}|dkr�t||�r�dS|j|�q�Wq�Wt|�dkrtd|d	jtt|��f��n;t|�dkr?td
||df��ntd��dS)
a=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.
        zempty or no certificate�subjectAltName�DNSN�subject�
commonNamerz&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found)	�
ValueError�getr.r�lenr
r!rr)�certr%�dnsnames�san�key�value�subrrrros.%rc@s.eZdZdZdd�Zdd�ZdS)rz=Simple verifying handler: no auth, subclasses, timeouts, etc.cCs||_tj|�dS)N)�	ca_bundle�HTTPSHandler�__init__)�selfr<rrrr>�s	zVerifyingHTTPSHandler.__init__cs�j�fdd�|�S)Ncst|�j|�S)N)�VerifyingHTTPSConnr<)�host�kw)r?rr�<lambda>�sz2VerifyingHTTPSHandler.https_open.<locals>.<lambda>)�do_open)r?�reqr)r?r�
https_open�sz VerifyingHTTPSHandler.https_openN)rrr�__doc__r>rFrrrrr�sc@s.eZdZdZdd�Zdd�ZdS)r@z@Simple verifying connection: no auth, subclasses, timeouts, etc.cKs tj|||�||_dS)N)�HTTPSConnectionr>r<)r?rAr<rBrrrr>�szVerifyingHTTPSConn.__init__cCs�tj|j|jft|dd��}t|d�rjt|dd�rj||_|j�|j}n	|j}t	j
|dt	jd|j�|_yt
|jj�|�Wn5tk
r�|jjtj�|jj��YnXdS)N�source_address�_tunnel�_tunnel_host�	cert_reqs�ca_certs)�socket�create_connectionrA�port�getattr�hasattr�sockrJrK�ssl�wrap_socket�
CERT_REQUIREDr<r�getpeercertr
�shutdown�	SHUT_RDWR�close)r?rS�actual_hostrrr�connect�s$!	
	

zVerifyingHTTPSConn.connectN)rrrrGr>r\rrrrr@�sr@cCs"tjjt|pt���jS)z@Get a urlopen() replacement that uses ca_bundle for verification)r�request�build_openerrr	�open)r<rrrr�s	cs%tj���fdd��}|S)Ncs(t�d�s!�||��_�jS)N�always_returns)rRr`)�args�kwargs)�funcrr�wrapper�szonce.<locals>.wrapper)�	functools�wraps)rcrdr)rcr�once�s!rgcsryddl}Wntk
r(dSYnXG�fdd�d|j����}|jd�|jd�|jS)Nrcs:eZdZ��fdd�Z��fdd�Z�S)z"get_win_certfile.<locals>.CertFilecs't�|�j�tj|j�dS)N)�superr>�atexit�registerrZ)r?)�CertFile�	__class__rrr>�sz+get_win_certfile.<locals>.CertFile.__init__cs0yt�|�j�Wntk
r+YnXdS)N)rhrZ�OSError)r?)rkrlrrrZ�s
z(get_win_certfile.<locals>.CertFile.close)rrrr>rZr)rk)rlrrk�srk�CA�ROOT)�wincertstore�ImportErrorrkZaddstore�name)rpZ	_wincertsr)rkr�get_win_certfile�s
		

rscCs4ttjjt�}t�p3t|d�p3t�S)z*Return an existing CA bundle path, or NoneN)r�os�path�isfilerrs�next�_certifi_where)Zextant_cert_pathsrrrr	�s	c
Cs6ytd�j�SWntttfk
r1YnXdS)N�certifi)�
__import__�whererqrrrrrrrx�srx)%rtrNrirreZsetuptools.extern.six.movesrrrr�
pkg_resourcesrrrTrq�__all__�striprrr]r=rH�AttributeError�objectr
r
rZbackports.ssl_match_hostnamer3r.rr@rrgrsr	rxrrrr�<module>sP"
	



4)
#	

?>