File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/__pycache__/ssl_match_hostname.cpython-310.pyc
Back
o ;j� � @ s6 d Z ddlZdZG dd� de�Zddd�Zd d � ZdS )a This is merely a copy of the actual code which comes verbatim from Python 3.4. If this code is already available on the system, the system copy should be used instead, as the system copy may be more current. If it is not available, then this copy will be used. � Nz3.4.0.2c @ s e Zd ZdS )�CertificateErrorN)�__name__� __module__�__qualname__� r r �O/opt/saltstack/salt/lib/python3.10/site-packages/salt/ext/ssl_match_hostname.pyr s r � c C s� g }| sdS | � d�}|d }|dd� }|�d�}||kr&tdt| � ��|s0| �� |�� kS |dkr:|�d� n|�d �sD|�d �rM|�t�|�� n|�t�|�� d d�� |D ] }|�t�|�� q[t� dd �|� d tj�} | � |�S )zhMatching 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)�split�countr �repr�lower�append� startswith�re�escape�replace�compile�join� IGNORECASE�match) �dn�hostnameZ max_wildcardsZpats�partsZleftmost� remainder� wildcards�frag�patr r r �_dnsname_match s, � r c C s� | st d��g }| �dd�}|D ]\}}|dkr%t||�r dS |�|� q|sJ| �dd�D ]}|D ]\}}|dkrHt||�rC dS |�|� q2q.t|�dkr^td |d �tt|��f ��t|�dkrntd||d f ��td ��)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�subjectAltNamer �DNSN�subject� 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) � ValueError�getr r �lenr r �mapr )�certr �dnsnames�san�key�value�subr r r �match_hostnameL s8 � ��� �r. )r )�__doc__r �__version__r$ r r r. r r r r �<module> s 5
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings