3 ՔRe,! " @ s d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm Z d dl mZmZ yd dl Z W n ek rt dZ Y nX dddddgZd j j ZyejjZejZW n ek r e ZZY nX e dk oeeefkZyd d l mZmZ W nR ek r: yd dlmZ d dlmZ W n ek r4 dZdZY nX Y nX esRG d d deZesjdddZdd ZG dd deZG dd deZd ddZ dd Z!e!dd Z"dd Z#dd Z$dS )! N)urllibhttp_clientmapfilter)ResolutionErrorExtractionErrorVerifyingHTTPSHandlerfind_ca_bundleis_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 )CertificateErrormatch_hostname)r )r c @ s e Zd ZdS )r N)__name__ __module____qualname__ r r /builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el9.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/ssl_support.pyr 5 s r c C s g }| sdS | j d}|d }|dd }|jd}||krLtdt| |s`| j |j kS |dkrt|jd n>|jd s|jd r|jtj| n|jtj|j d d x|D ]}|jtj| qW tj dd j| d tj} | j |S )zpMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F.r r N*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr reprlowerappend startswithreescapereplacecompilejoin IGNORECASEmatch) dnhostname max_wildcardspatspartsleftmost remainder wildcardsfragpatr r r _dnsname_match; s* r. c C s | st dg }| jdf }x0|D ](\}}|dkr"t||r@dS |j| q"W |sxF| jdf D ]6}x0|D ](\}}|dkrjt||rdS |j| qjW q`W t|dkrtd|d jtt|f n*t|dkrtd ||d f ntddS ) 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 certificatesubjectAltNameDNSNsubject commonNamer z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rr z=no appropriate commonName or subjectAltName fields were found) ValueErrorgetr. r lenr r! r r )certr% dnsnamessankeyvaluesubr r r r o s. r c @ s e Zd ZdZdd Zdd ZdS )r z=Simple verifying handler: no auth, subclasses, timeouts, etc.c C s || _ tj| d S )N) ca_bundleHTTPSHandler__init__)selfr<