Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/logilab/common/__pycache__/urllib2ext.cpython-37.pyc

B

�d{TX
�@s�ddlmZddlZddlZddlZGdd�de�ZddlZe�	dej
�Zdd�ZGdd	�d	ej
�Zed
kr�ddlZddlZdej_dej_ddlZejejd�ddlZe��Ze�e�Ze�Ze�ee��ejd�Z e!d
e j"e �#��dS)�)�print_functionNc@seZdZdZdS)�GssapiAuthErrorz-raised on error during authentication processN)�__name__�
__module__�__qualname__�__doc__�rr�J/opt/alt/python37/lib/python3.7/site-packages/logilab/common/urllib2ext.pyrsrz (?:.*,)*\s*Negotiate\s*([^,]*),?cCs0x*|�d�D]}t�|�}|r|�d�SqWdS)Nzwww-authenticate�)Z
getheaders�RGX�search�group)�headersZauthreq�matchrrr	�get_negociate_values
rc@s4eZdZdZdZdd�Zdd�Zdd�Zd	d
�ZdS)�HTTPGssapiAuthHandlerz7Negotiate HTTP authentication using context from GSSAPIi�cCs|��dS)N)�_reset)�selfrrr	�__init__szHTTPGssapiAuthHandler.__init__cCsd|_d|_dS)Nr)�_retried�_context)rrrr	rszHTTPGssapiAuthHandler._resetcCs|jdk	rt�|j�dS)N)r�krbZauthGSSClientClean)rrrr	�
clean_context s
z#HTTPGssapiAuthHandler.clean_contextc
Cs��z��yN|jdkr(t�|��dd|d��|jd7_t�d|j�t|�}|dkrdt�d�dSt�d|�t�d|�	��\}|_
|dkr�td	|��t�|j
|�}|d
kr�td|��t�
|j
�}t�d|dd
��|�dd|�|j�|�}	t|	���}|dk�r t�d�n2t�d|�t�|j
|�}|dk�rRtd|��|	Stk
�r�}
zt�t|
��Wdd}
~
XYnXWd|��|��XdS)N�i�znegotiate auth failedr
zgssapi handler, try %sz/no negociate found in a www-authenticate headerz(HTTPGssapiAuthHandler: negotiate 1 is %rzHTTP@%sz*HTTPGssapiAuthHandler: init failed with %drz,HTTPGssapiAuthHandler: step 1 failed with %dz/HTTPGssapiAuthHandler: client response is %s...�
Z
AuthorizationzNegotiate %sz4HTTPGssapiAuthHandler: failed to authenticate serverz%HTTPGssapiAuthHandler negotiate 2: %sz,HTTPGssapiAuthHandler: step 2 failed with %d)r�urllib2Z	HTTPErrorZget_full_url�logging�debugrrZauthGSSClientInitZget_hostrrZauthGSSClientStepZauthGSSClientResponseZadd_unredirected_header�parent�open�info�warning�error�reprrr)r�req�fp�code�msgrZ	negotiate�resultZclient_responseZserver_response�excrrr	�http_error_401$sB




$z$HTTPGssapiAuthHandler.http_error_401N)	rrrrZ
handler_orderrrrr*rrrr	rsr�__main__r
)�levelz
response: %s
--------------
)$�
__future__rrrZkerberosr�	Exceptionr�re�compile�IrrZBaseHandlerrr�sysZhttplibZHTTPConnectionZ
debuglevelZHTTPSConnection�basicConfig�DEBUGZ	cookielibZ	CookieJarZcjZHTTPCookieProcessor�ch�hZbuild_openerr�argv�response�printr&r rrrr	�<module>s*5