Your IP : 3.17.183.187


Current Path : /opt/alt/python36/lib/python3.6/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/setuptools/__pycache__/ssl_support.cpython-36.pyc

3

K�Re,!�"@s�ddlZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
mZmZyddl
Z
Wnek
rtdZ
YnXdddddgZd	j�j�ZyejjZejZWnek
r�eZZYnXe
dk	o�eeefkZydd
l
mZmZWnRek
�r:yddlmZddlmZWnek
�r4dZdZYnXYnXe�sRGd
d�de�Ze�sjddd�Zdd�ZGdd�de�ZGdd�de�Zd dd�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@seZdZdS)r
N)�__name__�
__module__�__qualname__�rr��/builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/ssl_support.pyr
5sr
�c
Cs�g}|sdS|jd�}|d}|dd�}|jd�}||krLtdt|���|s`|j�|j�kS|dkrt|jd�n>|jd	�s�|jd	�r�|jtj|��n|jtj|�j	d
d��x|D]}|jtj|��q�Wtj
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.cCs�|std��g}|jdf�}x0|D](\}}|dkr"t||�r@dS|j|�q"W|s�xF|jdf�D]6}x0|D](\}}|dkrjt||�r�dS|j|�qjWq`Wt|�dkr�td|d	jtt|��f��n*t|�dkr�td
||df��ntd��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>�szVerifyingHTTPSHandler.__init__cs�j�fdd�|�S)Ncst|�jf|�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�sc@s eZdZdZdd�Zdd�ZdS)r@z@Simple verifying connection: no auth, subclasses, timeouts, etc.cKstj||f|�||_dS)N)�HTTPSConnectionr>r<)r?rAr<rBrrrr>�szVerifyingHTTPSConn.__init__cCs�tj|j|jft|dd��}t|d�rHt|dd�rH||_|j�|j}n|j}tt	d�rxt	j
|jd�}|j||d�|_nt	j|t	j
|jd�|_yt|jj�|�Wn.tk
r�|jjtj�|jj��YnXdS)N�source_address�_tunnel�_tunnel_host�create_default_context)�cafile)�server_hostname)�	cert_reqs�ca_certs)�socket�create_connectionrA�port�getattr�hasattr�sockrJrK�sslrLr<�wrap_socket�
CERT_REQUIREDr�getpeercertr
�shutdown�	SHUT_RDWR�close)r?rV�actual_host�ctxrrr�connect�s$

zVerifyingHTTPSConn.connectN)rrrrGr>r`rrrrr@�sr@cCstjjt|pt���jS)z@Get a urlopen() replacement that uses ca_bundle for verification)r�request�build_openerrr	�open)r<rrrr�scstj���fdd��}|S)Ncst�d�s�||��_�jS)N�always_returns)rUrd)�args�kwargs)�funcrr�wrapper�s
zonce.<locals>.wrapper)�	functools�wraps)rgrhr)rgr�once�srkcsXyddl}Wntk
r dSXG�fdd�d|j����}|jd�|jd�|jS)Nrcs,eZdZ��fdd�Z��fdd�Z�ZS)z"get_win_certfile.<locals>.CertFilecst�|�j�tj|j�dS)N)�superr>�atexit�registerr])r?)�CertFile�	__class__rrr>�sz+get_win_certfile.<locals>.CertFile.__init__cs,yt�|�j�Wntk
r&YnXdS)N)rlr]�OSError)r?)rorprrr]�sz(get_win_certfile.<locals>.CertFile.close)rrrr>r]�
__classcell__r)ro)rprro�sro�CA�ROOT)�wincertstore�ImportErrorroZaddstore�name)ruZ	_wincertsr)ror�get_win_certfile�s

rxcCs$ttjjt�}t�p"t|d�p"t�S)z*Return an existing CA bundle path, or NoneN)r�os�path�isfilerrx�next�_certifi_where)Zextant_cert_pathsrrrr	�s
c
Cs,ytd�j�Stttfk
r&YnXdS)N�certifi)�
__import__�wherervrrrrrrr}sr})r)N)%ryrQrmrriZsetuptools.extern.six.movesrrrr�
pkg_resourcesrrrWrv�__all__�striprrrar=rH�AttributeError�objectr
r
rZbackports.ssl_match_hostnamer3r.rr@rrkrxr	r}rrrr�<module>sP


4)
(
	

?>