§
    ŒÜgn�  ã                   ó4  — d dl Z d dlZd dlZd dlZd dlZddlmZ ddlmZ ddl	m
Z
 ddlmZmZmZmZ ddlmZmZmZ h d£Z eed	d
¦  «        Z e¦   «         Z eed ej        ed¦  «        ¦  «        re                     d¦  «          eed ej        ed¦  «        ¦  «        re                     d¦  «          eed ej        ed¦  «        ¦  «        re                     d¦  «         d„ Zd„ Zdd„Z	 d d„Z G d„ de¦  «        Zd!d„Zd„ Z d„ Z!d„ Z"d„ Z#dS )"é    Né   )Ú_)Úgetattr)Úhex)ÚencodingÚerrorÚpycompatÚutil)ÚhashutilÚresourceutilÚ
stringutil>   ó   tls1.0ó   tls1.1ó   tls1.2ÚHAS_SNIFÚ	HAS_TLSv1ÚPROTOCOL_TLSv1r   ÚHAS_TLSv1_1ÚPROTOCOL_TLSv1_1r   ÚHAS_TLSv1_2ÚPROTOCOL_TLSv1_2r   c           	      óÖ  — t          j        |¦  «        }dg dddddddœ}d„ }t          dhz
  sJ ‚d}d}|                      d	||¦  «        } |||¦  «         d
|z  }|                      d	||¦  «        } |||¦  «         |                      d	d¦  «        }|                      d	d|z  |¦  «        }| j        rd}|sd}||d<   ||d<   |                      d	d|z  ¦  «        }	|	D ]ª}
|
                     d¦  «        s5t          j        t          d¦  «        ||
fz  t          d¦  «        ¬¦  «        ‚|
 
                    dd¦  «        \  }}
|
                     dd¦  «                             ¦   «         }
|d                              ||
f¦  «         Œ«|                      d|¦  «        D ]L}
|
                     dd¦  «                             ¦   «         }
|d                              d|
f¦  «         d|d<   ŒM|d         rt          j        |d<   d|d<   n | j        rd|d<   t          j        |d<   d|d<   |                      dd¦  «        rd|d<   |                      d	d|z  ¦  «        }|d         r'|r%|                      t          d ¦  «        |z  ¦  «         |d         �€G|rct%          j        |¦  «        }t(          j                             |¦  «        s*t          j        t          d!¦  «        d"|fz  |fz  ¦  «        ‚||d#<   n¹|                      d$d%¦  «        }|rkt%          j        |¦  «        }t(          j                             |¦  «        s7t          j        t          d&¦  «        |z  t          d'¦  «        d(z  z   ¦  «        ‚n1|d         r)t/          | ¦  «        }|r|                      d)|z  ¦  «         ||d#<   |s|d         rt          j        |d<   nt          j        |d<   |d         €J ‚|S )*zhObtain security settings for a hostname.

    Returns a dict of settings relevant to that hostname.
    TNF)ó   allowloaddefaultcertsó   certfingerprintsó   cafileó   disablecertverificationó   legacyfingerprintó   minimumprotocoló
   verifymodeó   ciphersc           	      óÒ   — | t           vr]t          j        t          d¦  «        || fz  t          d¦  «        d                     t          t           ¦  «        ¦  «        z  ¬¦  «        ‚d S )Ns-   unsupported protocol from hostsecurity.%s: %ss   valid protocols: %só    ©Úhint)Úconfigprotocolsr   ÚAbortr   ÚjoinÚsorted)ÚprotocolÚkeys     ú3/usr/lib/python3/dist-packages/mercurial/sslutil.pyÚvalidateprotocolz'_hostsettings.<locals>.validateprotocolZ   sn   € Ø�?Ð*Ð*Ý”+ÝÐBÑCÔCØ˜�/ñ"åÐ-Ñ.Ô.Ø—)’)�F¥?Ñ3Ô3Ñ4Ô4ñ5ðñ ô ð ð +Ð*ó    r   r   r   ó   hostsecuritys   %s:minimumprotocolr    s
   %s:cipherss   DEFAULT:@SECLEVEL=0s   %s:fingerprints)s   sha1:s   sha256:s   sha512:s   invalid fingerprint for %s: %ss0   must begin with "sha1:", "sha256:", or "sha512:"r#   ó   :r   r-   r   s   hostfingerprintsó   sha1r   r   r   r   ó   devels   disableloaddefaultcertss   %s:verifycertsfiless   (hostsecurity.%s:verifycertsfile ignored when host fingerprints defined; using host fingerprints for verification)
s'   path specified by %s does not exist: %ss   hostsecurity.%s:verifycertsfiler   s   webs   cacertss   could not find web.cacerts: %ss     (try installing the %s package)s   ca-certificatess   using %s for CA file
)r	   ÚbytesurlÚsupportedprotocolsÚconfigÚinsecureconnectionsÚ
configlistÚ
startswithr   r&   r   ÚsplitÚreplaceÚlowerÚappendÚsslÚ	CERT_NONEÚ
configboolÚwarnr
   Ú
expandpathÚosÚpathÚexistsÚ_defaultcacertsÚdebugÚCERT_REQUIRED)ÚuiÚhostnameÚ	bhostnameÚsr,   Údefaultminimumprotocolr*   ÚminimumprotocolÚciphersÚfingerprintsÚfingerprintÚalgÚcafiles                r+   Ú_hostsettingsrR   =   sï  € õ
 Ô! (Ñ+Ô+€Ið #'àð à$)à#ð !ààð'	ð 	€Að.ð ð õ   Ñ+Ð+Ð+Ð+Ø&Ðà
€CØ—i’i °Ð6LÑMÔM€OØÐ�_ cÑ*Ô*Ð*à
 )Ñ
+€CØ—i’i °°oÑFÔF€OØÐ�_ cÑ*Ô*Ð*à�iŠi˜¨Ñ4Ô4€GØ�iŠi˜¨¸Ñ)BÀGÑLÔL€Gð
 
Ôð -Ø#ˆØð 	-Ø,ˆGà+€AÐÑØ€A€j�Mð —=’=ØÐ+¨iÑ7ñô €Lð $ð :ð :ˆØ×&Ò&Ð'IÑJÔJð 	Ý”+ÝÐ3Ñ4Ô4¸	À;Ð7OÑOÝÐJÑKÔKðñ ô ð ð
 '×,Ò,¨T°1Ñ5Ô5Ñˆˆ[Ø!×)Ò)¨$°Ñ4Ô4×:Ò:Ñ<Ô<ˆð 	
Ð
Ô×%Ò% s¨KÐ&8Ñ9Ô9Ð9Ð9ð —}’}Ð%8¸)ÑDÔDð 'ð 'ˆØ!×)Ò)¨$°Ñ4Ô4×:Ò:Ñ<Ô<ˆð 	
Ð
Ô×%Ò% w°Ð&<Ñ=Ô=Ð=à"&ˆÐ
ÑÐð 	Ð	Ôð ,Ýœ=ˆˆ-ÑØ&+ˆÐ
"Ñ#Ð#ð 
Ô	ð ,Ø(,ˆÐ
$Ñ%Ýœ=ˆˆ-ÑØ&+ˆÐ
"Ñ#à	‡}‚}�XÐ9Ñ:Ô:ð ,Ø&+ˆÐ
"Ñ#ð
 �YŠY�Ð(=À	Ñ(IÑJÔJ€FØÐ	Ôð 
 &ð 
Ø
�ŠÝð#ñô ð
 ññ	
ô 	
ð 	
ð 	ˆÔÑàð 	"Ý”_ VÑ,Ô,ˆFÝ”7—>’> &Ñ)Ô)ð Ý”kÝÐ@ÑAÔAà:¸i¸\ÑIØðññô ð ð "ˆAˆi‰LˆLð —Y’Y˜v zÑ2Ô2ˆFàð AÝœ¨Ñ0Ô0�Ý”w—~’~ fÑ-Ô-ð Ýœ+ÝÐ;Ñ<Ô<¸vÑEÝÐ=Ñ>Ô>ÐASÑSñTñô ð ðð
 Ð+Ô,ð Aå(¨Ñ,Ô,�Øð AØ—H’HÐ6¸Ñ?Ñ@Ô@Ð@à!ˆAˆi‰Lð ð 	-�QÐ/Ô0ð 	-Ý"Ô0ˆAˆmÑÐõ  #œ}ˆAˆmÑàˆ]ÔÐ'Ð'Ð'à€Hr-   c                 ób  — | t           vrt          d| z  ¦  «        ‚t          j        t          j        z  }| dk    rnZ| dk    r|t          j        z  }nD| dk    r|t          j        t          j        z  z  }n!t          j        t          d¦  «        ¦  «        ‚|t          t          dd¦  «        z  }|S )z8Return SSLContext options common to servers and clients.s    protocol value not supported: %sr   r   r   ó   this should not happenÚOP_NO_COMPRESSIONr   )r%   Ú
ValueErrorr<   ÚOP_NO_SSLv2ÚOP_NO_SSLv3ÚOP_NO_TLSv1ÚOP_NO_TLSv1_1r   r&   r   r   )rL   Úoptionss     r+   Úcommonssloptionsr\   î   s°   € à�oÐ-Ð-ÝÐ<¸ÑNÑOÔOÐOõ Œo¥¤Ñ/€Gà˜)Ò#Ð#àØ	˜IÒ	%Ð	%Ø•3”?Ñ"ˆˆØ	˜IÒ	%Ð	%Ø•3”?¥SÔ%6Ñ6Ñ6ˆˆåŒk�!Ð5Ñ6Ô6Ñ7Ô7Ð7ð �w•sÐ/°Ñ3Ô3Ñ3€Gà€Nr-   c           
      ó  ‡‡‡— |s!t          j        t          d¦  «        ¦  «        ‚dt          j        v rw	 ddl}|                     t          j        t          j        d         ¦  «        ¦  «         ‰ 	                    d¦  «         n%# t          $ r ‰ 	                    d¦  «         Y nw xY w‰‰fD ]j}|rft          j                             |¦  «        sGt          j        t          d¦  «        |t          j        |¦  «        fz  t          d¦  «        ¬	¦  «        ‚Œkt          ‰|¦  «        }t!          j        t$          d
¦  «        �rOt%          j        t$          j        ¦  «        }|d         }	|	dk    r]t+          j        ¦   «         5  t+          j        ddt0          ¦  «         t$          j        j        |_        ddd¦  «         n# 1 swxY w Y   n¡|	dk    r]t+          j        ¦   «         5  t+          j        ddt0          ¦  «         t$          j        j        |_        ddd¦  «         n# 1 swxY w Y   n>|	dk    rt$          j        j        |_        n!t          j        t          d¦  «        ¦  «        ‚|xj        t?          t$          dd¦  «        z  c_        nAt%          j        t$          j         ¦  «        }|xj        tC          |d         ¦  «        z  c_        d|_"        |d         |_#        |d         rŸ	 | $                    t          j%        |d         ¦  «        ¦  «         np# t$          j&        $ r^}
t          j        t          d¦  «        tO          j(        |
j)        d         ¦  «        z  t          d¦  «        |d         z  ¬	¦  «        ‚d}
~
ww xY w‰�ˆˆˆfd„}| *                    ‰‰|¦  «         |d         �¸	 | +                    |d         ¬¦  «         n—# t$          j&        $ r…}
tY          |
j)        ¦  «        dk    r|
j)        d         }n|
j)        d         }t          j        t          d¦  «        |d         tO          j(        |¦  «        fz  t          d¦  «        ¬	¦  «        ‚d}
~
ww xY wd}n!|d          r| -                    ¦   «          d}nd}	 | .                    | |¬!¦  «        }�n # t$          j&        $ �r}
	 |rL|d         t$          j/        k    r6| 0                    ¦   «         s"‰ 1                    t          d"¦  «        ¦  «         n# t$          j&        $ r Y nw xY wt!          j        |
d#¦  «        �rŒ|
j2        d$v �rI|d         dk    r¤tf          dhk    r`‰ 1                    t          d%¦  «        t          j        |¦  «        d& 4                    tk          tf          ¦  «        ¦  «        fz  ¦  «         �n
‰ 1                    t          d'¦  «        t          j        |¦  «        z  ¦  «         nÒ‰ 1                    t          d(¦  «        |d         t          j        |¦  «        fz  ¦  «         ‰ 1                    t          d)¦  «        t          j        |¦  «        z  ¦  «         ‰ 1                    t          d*¦  «        ¦  «         n9|
j2        d+k    r.t          j6        r"‰ 1                    t          d,¦  «        ¦  «         ‚ d}
~
ww xY w| 7                    ¦   «         s!t          j8        t          d-¦  «        ¦  «        ‚|||‰d.œ|_9        |S )/a¾  Add SSL/TLS to a socket.

    This is a glorified wrapper for ``ssl.wrap_socket()``. It makes sane
    choices based on what security options are available.

    In addition to the arguments supported by ``ssl.wrap_socket``, we allow
    the following additional arguments:

    * serverhostname - The expected hostname of the remote server. If the
      server (and client) support SNI, this tells the server which certificate
      to use.
    s#   serverhostname argument is requireds   SSLKEYLOGFILEr   Ns8   sslkeylog enabled by SSLKEYLOGFILE environment variable
s?   sslkeylog module missing, but SSLKEYLOGFILE set in environment
s:   certificate file (%s) does not exist; cannot connect to %ss:   restore missing file or fix references in Mercurial configr#   Ú
TLSVersionr   r   Úignoreú"ssl.TLSVersion.TLSv1 is deprecatedr   ú$ssl.TLSVersion.TLSv1_1 is deprecatedr   rT   rU   Fr   r    s   could not set ciphers: %ss#   change cipher string (%s) in configc                  óX   •— ‰p‰} ‰                      t          d¦  «        | z  d¦  «        S )Ns   passphrase for %s: r-   )Úgetpassr   )ÚfÚcertfileÚkeyfilerG   s    €€€r+   Úpasswordzwrapsocket.<locals>.passwordo  s/   ø€ ØÐ#˜8ˆAØ—:’:�aÐ 6Ñ7Ô7¸!Ñ;¸SÑAÔAÐAr-   r   ©rQ   r   s   error loading CA file %s: %ss   file is empty or malformed?Tr   )Úserver_hostnames¬   (an attempt was made to load CA certificates but none were loaded; see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error)
s   reason)ÚUNSUPPORTED_PROTOCOLÚTLSV1_ALERT_PROTOCOL_VERSIONsÞ   (could not communicate with %s using security protocols %s; if you are using a modern Mercurial version, consider contacting the operator of this server; see https://mercurial-scm.org/wiki/SecureConnections for more info)
ó   , sã   (could not communicate with %s using TLS 1.0; the likely cause of this is the server no longer supports TLS 1.0 because it has known security vulnerabilities; see https://mercurial-scm.org/wiki/SecureConnections for more info)
sš   (could not negotiate a common security protocol (%s+) with %s; the likely cause is Mercurial is configured to be more secure than the server can support)
sé   (consider contacting the operator of this server and ask them to support modern TLS protocol versions; or, set hostsecurity.%s:minimumprotocol=tls1.0 to allow use of legacy, less secure protocols when communicating with this server)
sE   (see https://mercurial-scm.org/wiki/SecureConnections for more info)
ÚCERTIFICATE_VERIFY_FAILEDsR   (the full certificate chain may not be available locally; see "hg help debugssl")
s   ssl connection failed)ó   caloadedó   hostnameó   settingsó   ui):r   r&   r   r   ÚenvironÚ	sslkeylogÚ
set_keylogr	   ÚfsdecodeÚ
warnnoi18nÚImportErrorrA   rB   rC   r2   rR   r
   Úsafehasattrr<   Ú
SSLContextÚPROTOCOL_TLS_CLIENTÚwarningsÚcatch_warningsÚfilterwarningsÚDeprecationWarningr^   ÚTLSv1Úminimum_versionÚTLSv1_1ÚTLSv1_2r[   r   ÚPROTOCOL_SSLv23r\   Úcheck_hostnameÚverify_modeÚset_ciphersÚsysstrÚSSLErrorr   ÚforcebytestrÚargsÚload_cert_chainÚload_verify_locationsÚlenÚload_default_certsÚwrap_socketrF   Úget_ca_certsr?   Úreasonr3   r'   r(   Ú	iswindowsÚcipherÚSecurityErrorÚ_hgstate)Úsockrf   re   rG   Úserverhostnamers   rd   ÚsettingsÚ
sslcontextrL   Úerg   ÚmsgÚcaloadedÚ	sslsockets    ```           r+   Ú
wrapsocketrž     s»  øøø€ ð ð EÝŒk�!ÐBÑCÔCÑDÔDÐDà�8Ô+Ð+Ð+ð	ØÐÐÐà× Ò ÝÔ!¥(Ô"2Ð3CÔ"DÑEÔEñô ð ð �MŠMØLñô ð ð øõ ð 	ð 	ð 	Ø�MŠMð:ñô ð ð ð ð	øøøð �xÐ ð 	ð 	ˆØð 	•R”W—^’^ AÑ&Ô&ð 	Ý”+ÝÐOÑPÔPØ•hÔ'¨Ñ7Ô7Ð8ñ9åð+ñô ðñ ô ð øõ ˜R Ñ0Ô0€Hõ Ô�˜\Ñ*Ô*ñ  Må”^¥CÔ$;Ñ<Ô<ˆ
Ø"Ð#5Ô6ˆØ˜iÒ'Ð'ÝÔ(Ñ*Ô*ð Bð BÝÔ'ØØ8Ý&ñô ð õ
 .1¬^Ô-A�
Ô*ðBð Bð Bñ Bô Bð Bð Bð Bð Bð Bð Bøøøð Bð Bð Bð Bøð  	Ò)Ð)ÝÔ(Ñ*Ô*ð Dð DÝÔ'ØØ:Ý&ñô ð õ
 .1¬^Ô-C�
Ô*ðDð Dð Dñ Dô Dð Dð Dð Dð Dð Dð Døøøð Dð Dð Dð Døð  	Ò)Ð)Ý),¬Ô)?ˆJÔ&Ð&å”+�aÐ 9Ñ:Ô:Ñ;Ô;Ð;ð 	ÐÔ�g¥cÐ+>ÀÑBÔBÑBÐÔÐõ
 ”^¥CÔ$7Ñ8Ô8ˆ
ØÐÔÕ.¨xÐ8JÔ/KÑLÔLÑLÐÔð !&€JÔØ% mÔ4€JÔà�
Ôð 	ð	Ø×"Ò"¥8¤?°8¸JÔ3GÑ#HÔ#HÑIÔIÐIÐIøÝŒ|ð 	ð 	ð 	Ý”+ÝÐ.Ñ/Ô/ÝÔ)¨!¬&°¬)Ñ4Ô4ñ5åÐ=Ñ>Ô>Ø˜:Ô&ñ'ðñ ô ð øøøøð	øøøð Ðð	Bð 	Bð 	Bð 	Bð 	Bð 	Bð 	Bð 	×"Ò" 8¨W°hÑ?Ô?Ð?à�	ÔÐ&ð	Ø×,Ò,°H¸YÔ4GÐ,ÑHÔHÐHÐHøÝŒ|ð 		ð 		ð 		Ý�1”6‰{Œ{˜aÒÐØ”f˜Q”i��à”f˜Q”i�Ý”+ÝÐ1Ñ2Ô2Ø˜IÔ&­
Ô(?ÀÑ(DÔ(DÐEñFåÐ5Ñ6Ô6ðñ ô ð øøøøð		øøøð ˆˆØ	Ð*Ô	+ð à×%Ò%Ñ'Ô'Ð'ØˆˆàˆðsØ×*Ò*¨4ÀÐ*ÑPÔPˆ	‰	øÝŒ<ð qñ qð qð	àðà˜]Ô+­sÔ/@Ò@Ð@Ø"×/Ò/Ñ1Ô1ð Að —’Ýð$ñô ñô ð øøõ Œ|ð 	ð 	ð 	ØˆDð	øøøõ Ô˜A˜yÑ)Ô)ñ U	ð Œxð ð ñ ð
 Ð.Ô/°9Ò<Ð<õ *¨i¨[Ò8Ð8ØŸšÝð!4ñô õ !)Ô 1°.Ñ AÔ AØ %§
¢
­6Õ2DÑ+EÔ+EÑ FÔ Fðññô ð ñ ð ŸšÝð!4ñô õ 'Ô/°Ñ?Ô?ñ@ñ
ô 
ð 
ð 
ð  —G’GÝðPñô ð %Ð%7Ô8Ý$Ô-¨nÑ=Ô=ðññ
ô 
ð 
ð —G’GÝðAñô õ #Ô+¨NÑ;Ô;ñ<ñ
ô 
ð 
ð —G’GÝð0ñô ñô ð ð ð ”Ð8Ò8Ð8½XÔ=OÐ8à—’Ýð>ñô ñô ð ð 	øøøøðcqøøøðl ×ÒÑÔð ?ÝÔ!¥!Ð$<Ñ"=Ô"=Ñ>Ô>Ð>ð Ø#ØØð	ð €IÔð Ðs    ¶AB ÂB)Â(B)Æ2GÇGÇ
GÇ(2H&È&H*È-H*Ë3-L! Ì!NÌ0AN	Î	NÎ:O ÏQ+Ï&B Q&Ñ&Q+ÒR, Ò,[	Ò=ATÔ[ÔTÔ[ÔTÔF&[Û[	c                 óÚ	  — |||fD ]G}|rCt           j                             |¦  «        s$t          j        t          d¦  «        |z  ¦  «        ‚ŒHt          j        t          d¦  «        �r&t          j	        t          j
        ¦  «        }|xj        t          t          dd¦  «        z  c_        |                     dd¦  «        }|dk    rždt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        ¦   «         5  t          j        d	d
t$          ¦  «         t          j        j        |_        t          j        j        |_        ddd¦  «         n# 1 swxY w Y   �n\|dk    rždt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        ¦   «         5  t          j        d	dt$          ¦  «         t          j        j        |_        t          j        j        |_        ddd¦  «         n# 1 swxY w Y   �n¸|dk    rXdt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        j        |_        t          j        j        |_        �nZ|r$t          j        t          d¦  «        |z  ¦  «        ‚�n2t          j        }	t5          d¦  «        }
|                     dd¦  «        }|dk    r7dt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        }	n |dk    r7dt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        }	nc|dk    r7dt          vr!t          j        t          d¦  «        ¦  «        ‚t          j        }	n&|r$t          j        t          d¦  «        |z  ¦  «        ‚t          j	        |	¦  «        }|xj        |
z  c_        |xj        t          t          dd¦  «        z  c_        |xj        t          t          dd¦  «        z  c_        |r|                     d¦  «         n]t          j        t          d¦  «        rC|xj        t          t          dd¦  «        z  c_        |                     t          j        ¦  «         |rt          j         |_!        nt          j"        |_!        |s|r| #                    ||¬¦  «         |r| $                    |¬¦  «         | %                    | d¬¦  «        S )aæ  Wrap a socket for use by servers.

    ``certfile`` and ``keyfile`` specify the files containing the certificate's
    public and private keys, respectively. Both keys can be defined in the same
    file via ``certfile`` (the private key must come first in the file).

    ``cafile`` defines the path to certificate authorities.

    ``requireclientcert`` specifies whether to require client certificates.

    Typically ``cafile`` is only defined if ``requireclientcert`` is true.
    s/   referenced certificate file (%s) does not existr^   rU   r   r1   s   serverexactprotocolr   s$   TLS 1.0 not supported by this Pythonr_   r`   Nr   s$   TLS 1.1 not supported by this Pythonra   r   s$   TLS 1.2 not supported by this Pythons)   invalid value for serverexactprotocol: %sÚOP_SINGLE_DH_USEÚOP_SINGLE_ECDH_USEzDEFAULT:@SECLEVEL=0s   _RESTRICTED_SERVER_CIPHERSÚOP_CIPHER_SERVER_PREFERENCE)re   rf   rh   T)Úserver_side)&rA   rB   rC   r   r&   r   r
   rx   r<   ry   ÚPROTOCOL_TLS_SERVERr[   r   r4   r3   r{   r|   r}   r~   r^   r   r€   Úmaximum_versionr�   r‚   rƒ   r\   r   r   r   r†   Ú_RESTRICTED_SERVER_CIPHERSrF   r…   r=   r‹   rŒ   r�   )r–   rG   re   rf   rQ   Úrequireclientcertrd   r™   Úexactprotocolr)   r[   s              r+   Úwrapserversocketr©     sf  € ð" ˜ Ð(ð ð ˆØð 	•R”W—^’^ AÑ&Ô&ð 	Ý”+ÝÐDÑEÔEÈÑIñô ð øõ Ô�˜\Ñ*Ô*ñ F&å”^¥CÔ$;Ñ<Ô<ˆ
ØÐÔ�g¥cÐ+>ÀÑBÔBÑBÐÔð Ÿ	š	 (Ð,BÑCÔCˆØ˜IÒ%Ð%ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝÔ(Ñ*Ô*ð Bð BÝÔ'ØØ8Ý&ñô ð õ
 .1¬^Ô-A�
Ô*Ý-0¬^Ô-A�
Ô*ðBð Bð Bñ Bô Bð Bð Bð Bð Bð Bð Bøøøð Bð Bð Bð Bùð ˜iÒ'Ð'ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝÔ(Ñ*Ô*ð Dð DÝÔ'ØØ:Ý&ñô ð õ
 .1¬^Ô-C�
Ô*Ý-0¬^Ô-C�
Ô*ðDð Dð Dñ Dô Dð Dð Dð Dð Dð Dð Døøøð Dð Dð Dð Dùð ˜iÒ'Ð'ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝ),¬Ô)?ˆJÔ&Ý),¬Ô)?ˆJÔ&Ñ&Øð 	Ý”+ÝÐ>Ñ?Ô?À-ÑOñô ð ñ	õ Ô&ˆÝ" 9Ñ-Ô-ˆð Ÿ	š	 (Ð,BÑCÔCˆØ˜IÒ%Ð%ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝÔ)ˆHˆHØ˜iÒ'Ð'ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝÔ+ˆHˆHØ˜iÒ'Ð'ØÕ 2Ð2Ð2Ý”k¥!Ð$KÑ"LÔ"LÑMÔMÐMÝÔ+ˆHˆHØð 	Ý”+ÝÐ>Ñ?Ô?À-ÑOñô ð õ ”^ HÑ-Ô-ˆ
ØÐÔ˜gÑ%ÐÔð ÐÔ�'¥#Ð'9¸1Ñ=Ô=Ñ=ÐÔØÐÔ�'¥#Ð';¸QÑ?Ô?Ñ?ÐÔð ð ?Ø×ÒÐ4Ñ5Ô5Ð5Ð5Ý	Ô	�#Ð<Ñ	=Ô	=ð ?ØÐÔ�g¥cÐ+HÈ!ÑLÔLÑLÐÔà×Ò�sÔ=Ñ>Ô>Ð>ð ð /Ý!$Ô!2ˆ
ÔÐå!$¤ˆ
Ôàð G�7ð GØ×"Ò"¨H¸gÐ"ÑFÔFÐFàð 8Ø×(Ò(°Ð(Ñ7Ô7Ð7à×!Ò! $°DÐ!Ñ9Ô9Ð9s&   ÄAEÅEÅEÆ(AG<Ç<H ÈH c                   ó   — e Zd ZdZdS )Úwildcarderrorz2Represents an error parsing wildcards in DNS name.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r-   r+   r«   r«   Š  s   € € € € € Ø<Ð<Ð<Ð<r-   r«   c                 óÀ  — g }| sdS t          j        | ¦  «        } t          j        |¦  «        }|                      d¦  «        }|d         }|dd…         }|                     d¦  «        }||k    rt	          t          d¦  «        | z  ¦  «        ‚|s*|                      ¦   «         |                     ¦   «         k    S |dk    r|                     d¦  «         n�|                     d	¦  «        s|                     d	¦  «        r(|                     t          j
        |¦  «        ¦  «         n;|                     t          j
        |¦  «                             d
d¦  «        ¦  «         |D ])}|                     t          j
        |¦  «        ¦  «         Œ*t          j        dd                     |¦  «        z   dz   t          j        ¦  «        }	|	                     |¦  «        duS )zÜMatch DNS names according RFC 6125 section 6.4.3.

    This code is effectively copied from CPython's ssl._dnsname_match.

    Returns a bool indicating whether the expected hostname matches
    the value in ``dn``.
    Fó   .r   r   Nó   *s.   too many wildcards in certificate DNS name: %ss   [^.]+s   xn--s   \*s   [^.]*s   \As   \.s   \Z)r	   r2   r8   Úcountr«   r   r:   r;   r7   r   Úreescaper9   ÚreÚcompiler'   Ú
IGNORECASEÚmatch)
ÚdnrH   ÚmaxwildcardsÚpatsÚpiecesÚleftmostÚ	remainderÚ	wildcardsÚfragÚpats
             r+   Ú_dnsnamematchrÃ   Ž  sÔ  € ð €DØð ØˆuÝ	Ô	˜2Ñ	Ô	€BÝÔ  Ñ*Ô*€Hà�XŠX�d‰^Œ^€FØ�aŒy€HØ�q�r�r”
€IØ—’˜tÑ$Ô$€IØ�<ÒÐÝÝÐ?Ñ@Ô@À2ÑEñ
ô 
ð 	
ð
 ð .Ø�xŠx‰zŒz˜XŸ^š^Ñ-Ô-Ò-Ð-ð
 �4ÒÐð 	�Š�HÑÔÐÐØ	×	Ò	˜WÑ	%Ô	%ð M¨×)<Ò)<¸WÑ)EÔ)Eð Mð
 	�Š•JÔ'¨Ñ1Ô1Ñ2Ô2Ð2Ð2ð 	�Š•JÔ'¨Ñ1Ô1×9Ò9¸&À(ÑKÔKÑLÔLÐLð ð /ð /ˆØ�Š•JÔ'¨Ñ-Ô-Ñ.Ô.Ð.Ð.å
Œ*�V˜fŸkšk¨$Ñ/Ô/Ñ/°&Ñ8½"¼-Ñ
HÔ
H€CØ�9Š9�XÑÔ dÐ*Ð*r-   c                 óÀ  — | st          d¦  «        S g }|                      dg ¦  «        }|D ]m\  }}|dk    rb	 t          ||¦  «        r dS n8# t          $ r+}t	          j        |j        d         ¦  «        cY d}~c S d}~ww xY w|                     |¦  «         Œn|sÆ|                      dg ¦  «        D ]¯}|D ]ª\  }}|dk    rŸ	 |                     d¦  «        }n## t          $ r t          d	¦  «        cY c c S w xY w	 t          ||¦  «        r  dS n:# t          $ r-}t	          j        |j        d         ¦  «        cY d}~c c S d}~ww xY w|                     |¦  «         Œ«Œ°d
„ |D ¦   «         }t          |¦  «        dk    r%t          d¦  «        d                     |¦  «        z  S t          |¦  «        dk    rt          d¦  «        |d         z  S t          d¦  «        S )z«Verify that cert (in socket.getpeercert() format) matches hostname.
    CRLs is not handled.

    Returns error message if any problems are found and None on success.
    s   no certificate receivedÚsubjectAltNameÚDNSNr   ÚsubjectÚ
commonNameÚasciis    IDN in certificate not supportedc                 ó6   — g | ]}t          j        |¦  «        ‘ŒS r°   )r	   r2   )Ú.0Úds     r+   ú
<listcomp>z_verifycert.<locals>.<listcomp>ì  s#   € Ð7Ð7Ð7¨•Ô! !Ñ$Ô$Ð7Ð7Ð7r-   r   s   certificate is for %srl   s4   no commonName or subjectAltName found in certificate)r   ÚgetrÃ   r«   r   r‰   rŠ   r;   ÚencodeÚUnicodeEncodeErrorr�   r'   )ÚcertrH   ÚdnsnamesÚsanr*   Úvaluerš   Úsubs           r+   Ú_verifycertrÖ   Â  s„  € ð ð -ÝÐ+Ñ,Ô,Ð,à€HØ
�(Š(Ð# RÑ
(Ô
(€CØð #ð #‰
ˆˆUØ�%Š<ˆ<ð:Ý  ¨Ñ1Ô1ð Ø�F�Fðøå ð :ð :ð :Ý!Ô.¨q¬v°a¬yÑ9Ô9Ð9Ð9Ð9Ð9Ð9Ð9Ð9Ð9øøøøð:øøøð �OŠO˜EÑ"Ô"Ð"øàð +à—8’8˜I rÑ*Ô*ð 	+ð 	+ˆCØ!ð +ð +‘
��Uð ˜,Ò&Ð&ðFØ %§¢¨WÑ 5Ô 5˜˜øÝ-ð Fð Fð FÝ Ð!DÑEÔEÐEÐEÐEÐEÐEÐEÐEðFøøøðBÝ(¨°Ñ9Ô9ð #Ø"˜F˜F˜Fð#øå(ð Bð Bð BÝ)Ô6°q´v¸a´yÑAÔAÐAÐAÐAÐAÐAÐAÐAÐAÐAÐAøøøøðBøøøð —O’O EÑ*Ô*Ð*øð!+ð$ 8Ð7¨hÐ7Ñ7Ô7€HÝ
ˆ8�}„}�qÒÐÝÐ)Ñ*Ô*¨U¯ZªZ¸Ñ-AÔ-AÑAÐAÝ	ˆX‰Œ˜!Ò	Ð	ÝÐ)Ñ*Ô*¨X°a¬[Ñ8Ð8åÐHÑIÔIÐIsM   ¸AÁ
BÁA<Á4BÁ<BÃCÃC8Ã7C8Ã<DÄ
EÄEÄ9EÅEc                  ó&  — t           j        rt          j        ¦   «         st           j        sdS t
          j                             t           j        ¦  «                             ¦   «         } |  	                    d¦  «        p|  	                    d¦  «        S )a@  return true if this seems to be a pure Apple Python that
    * is unfrozen and presumably has the whole mercurial module in the file
      system
    * presumably is an Apple Python that uses Apple OpenSSL which has patches
      for using system certificate store CAs in addition to the provided
      cacerts file
    Fs   /usr/bin/pythons,   /system/library/frameworks/python.framework/)
r	   Úisdarwinr   Ú
mainfrozenÚsysexecutablerA   rB   Úrealpathr:   r7   )Úexes    r+   Ú_plainapplepythonrÝ   õ  s…   € õ ÔðåÔ"Ñ$Ô$ðõ Ô%ðð
 ˆuÝ
Œ'×
Ò
�8Ô1Ñ
2Ô
2×
8Ò
8Ñ
:Ô
:€CØ�>Š>Ð,Ñ-Ô-ð °·²Ø7ñ2ô 2ð r-   c                 óþ  — 	 ddl }|                     ¦   «         }t          j                             |¦  «        r)|                      d¦  «         t          j        |¦  «        S n# t          t          f$ r Y nw xY wt          ¦   «         rut          j                             t          j                             t          j        t          ¦  «        ¦  «        d¦  «        }t          j                             |¦  «        r|S dS )a™  return path to default CA certificates or None.

    It is assumed this function is called when the returned certificates
    file will actually be used to validate connections. Therefore this
    function may print warnings or debug messages assuming this usage.

    We don't print a message when the Python is able to load default
    CA certs because this scenario is detected at socket connect time.
    r   Ns#   using ca certificates from certifi
s   dummycert.pem)ÚcertifiÚwhererA   rB   rC   rE   r	   Úfsencoderw   ÚAttributeErrorrÝ   r'   ÚdirnameÚ__file__)rG   rß   ÚcertsÚ	dummycerts       r+   rD   rD   	  sê   € ðØˆˆˆà—’‘”ˆÝŒ7�>Š>˜%Ñ Ô ð 	,Ø�HŠHÐ<Ñ=Ô=Ð=ÝÔ$ UÑ+Ô+Ð+ð	,øõ �Ð(ð ð ð Øˆðøøøõ ÑÔð Ý”G—L’LÝŒG�OŠO�HÔ-­hÑ7Ô7Ñ8Ô8Ð:Jñ
ô 
ˆ	õ Œ7�>Š>˜)Ñ$Ô$ð 	ØÐàˆ4s   ‚AA# Á#A7Á6A7c           	      óP  — | j         d         }t          j        |¦  «        }| j         d         }| j         d         }	 |                      d¦  «        }|                      ¦   «         }n2# t          $ r% t          j        t          d¦  «        |z  ¦  «        ‚w xY w|s$t          j        t          d¦  «        |z  ¦  «        ‚|d         r'|                     t          d¦  «        |z  ¦  «         d	S t          t          j        |¦  «                             ¦   «         ¦  «        t          t          j        |¦  «                             ¦   «         ¦  «        t          t          j        |¦  «                             ¦   «         ¦  «        d
œ}d„ }d ||d         ¦  «        z  }	|d         rï|d         D ]z\  }
}||
                              ¦   «         |k    rW|                     d||
 ||¦  «        fz  ¦  «         |d         r(|                     t          d¦  «        |||	fz  ¦  «          d	S Œ{|d         rd} ||d         ¦  «        }nd}d|
 |||
         ¦  «        fz  }t          j        t          d¦  «        ||fz  t          d¦  «        |z  ¬¦  «        ‚| j         d         s8t          j        t          d¦  «        |z  t          d¦  «        ||	fz  ¬¦  «        ‚t%          ||¦  «        }|r:t          j        t          d¦  «        ||fz  t          d¦  «        ||	fz  ¬¦  «        ‚d	S )zxValidate a socket meets security requirements.

    The passed socket must have been created with ``wrapsocket()``.
    ro   rq   rp   Ts   %s ssl connection errors-   %s certificate error: no certificate receivedr   s�   warning: connection security to %s is disabled per current settings; communication is susceptible to eavesdropping and tampering
N)r0   ó   sha256s   sha512c           	      ó~   ‡ — d                      ˆ fd„t          dt          ‰ ¦  «        d¦  «        D ¦   «         ¦  «        S )Nr/   c                 ó*   •— g | ]}‰||d z   …         ‘ŒS )é   r°   )rË   ÚxrJ   s     €r+   rÍ   z:validatesocket.<locals>.fmtfingerprint.<locals>.<listcomp>[  s%   ø€ ÐDÐDÐD¨1˜!˜A  A¡˜Iœ,ÐDÐDÐDr-   r   rë   )r'   Úranger�   )rJ   s   `r+   Úfmtfingerprintz&validatesocket.<locals>.fmtfingerprintZ  s<   ø€ Ø�yŠyÐDÐDÐDÐDµ°a½¸Q¹¼ÀÑ0CÔ0CÐDÑDÔDÑEÔEÐEr-   s	   sha256:%srè   r   s)   %s certificate matched fingerprint %s:%s
r   sñ   (SHA-1 fingerprint for %s found in legacy [hostfingerprints] section; if you trust this fingerprint, remove the old SHA-1 fingerprint from [hostfingerprints] and add the following entry to the new [hostsecurity] section: %s:fingerprints=%s)
s   hostfingerprintr0   r.   s   %s:%ss0   certificate for %s has unexpected fingerprint %ss   check %s configurationr#   rn   sP   unable to verify security of %s (no loaded CA certificates); refusing to connects£   see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.%s:fingerprints=%s to trust this servers   %s certificate error: %ss^   set hostsecurity.%s:certfingerprints=%s config setting or use --insecure to connect insecurely)r•   r	   r2   Úgetpeercertrâ   r   r”   r   r?   r   r   Úsha1ÚdigestÚhashlibÚsha256Úsha512r:   rE   rÖ   )r–   ÚshostÚhostrG   r˜   ÚpeercertÚ	peercert2Úpeerfingerprintsrî   ÚnicefingerprintÚhashrO   ÚsectionÚnicer›   s                  r+   Úvalidatesocketrþ   ,  sþ  € ð
 ŒM˜+Ô&€EÝÔ˜UÑ#Ô#€DØ	Œ�uÔ	€BØŒ}˜[Ô)€HðHØ×#Ò# DÑ)Ô)ˆØ×$Ò$Ñ&Ô&ˆ	ˆ	øÝð Hð Hð HÝÔ!¥!Ð$>Ñ"?Ô"?À$Ñ"FÑGÔGÐGðHøøøð ð 
ÝÔ!ÝÐ>Ñ?Ô?À$ÑFñ
ô 
ð 	
ð Ð*Ô+ð ð 	�ŠÝð#ñô ð
 ññ	
ô 	
ð 	
ð 	ˆõ
 •X”] 8Ñ,Ô,×3Ò3Ñ5Ô5Ñ6Ô6Ý•w”~ hÑ/Ô/×6Ò6Ñ8Ô8Ñ9Ô9Ý•w”~ hÑ/Ô/×6Ò6Ñ8Ô8Ñ9Ô9ðð ÐðFð Fð Fð # ^ ^Ð4DÀYÔ4OÑ%PÔ%PÑP€OàÐ#Ô$ð  
Ø!)Ð*=Ô!>ð 	ð 	ÑˆD�+Ø Ô%×+Ò+Ñ-Ô-°Ò<Ð<Ø—’ØAØ˜T > >°+Ñ#>Ô#>Ð?ñ@ñô ð ð Ð0Ô1ð Ø—G’GÝðMñô ð    Ð7ñ8ñ
ô 
ð 
ð ��ð# =ð( Ð(Ô)ð 	MØ(ˆGØ!�>Ð"2°7Ô";Ñ<Ô<ˆDˆDà%ˆGØ˜t ^ ^Ð4DÀTÔ4JÑ%KÔ%KÐLÑLˆDÝÔ!ÝÐAÑBÔBØ�TˆlñåÐ,Ñ-Ô-°Ñ7ð
ñ 
ô 
ð 	
ð Œ=˜Ô%ð 
ÝÔ!Ýð'ñô ð ñ	õ
 ðHñô ð
 �_Ð%ñ&ð
ñ 
ô 
ð 	
õ �i Ñ
'Ô
'€CØ
ð 	
ÝÔ!ÝÐ)Ñ*Ô*¨d°C¨[Ñ8Ýðñô ð
 �_Ð%ñ&ð
ñ 
ô 
ð 	
ð	
ð 	
s   ½)A' Á'/B)N)NNNF)r   )$rò   rA   r¶   r<   r{   Úi18nr   r	   r   Únoder   Ú r   r   r
   Úutilsr   r   r   r%   ÚhassniÚsetr3   rx   ÚaddrR   r\   rž   r©   Ú	Exceptionr«   rÃ   rÖ   rÝ   rD   rþ   r°   r-   r+   ú<module>r     s§  ðð €€€Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
Ø €€€à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ðð ð €ð 
ˆ��i Ñ	'Ô	'€ð �S‘U”UÐ Ø
€7ˆ3�Ð-˜TÔ-¨cÐ3CÑDÔDÑEÔEð &Ø×Ò˜9Ñ%Ô%Ð%Ø
€7ˆ3�Ð/˜tÔ/°Ð5GÑHÔHÑIÔIð &Ø×Ò˜9Ñ%Ô%Ð%Ø
€7ˆ3�Ð/˜tÔ/°Ð5GÑHÔHÑIÔIð &Ø×Ò˜9Ñ%Ô%Ð%ðnð nð nðbð ð ð2Eð Eð Eð EðR KPðx:ð x:ð x:ð x:ðv=ð =ð =ð =ð =�Iñ =ô =ð =ð1+ð 1+ð 1+ð 1+ðh0Jð 0Jð 0Jðfð ð ð( ð  ð  ðFp
ð p
ð p
ð p
ð p
r-   