PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /usr/libexec/kcare/python/kcarectl/
Server: Linux host100322.itwesthosting.com 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
IP: 144.91.64.173
Choose File :

Url:
Dir : //usr/libexec/kcare/python/kcarectl/fetch.pyc

�
S�ic@sddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZejej
gZdZdZdZed�Zd�Zd	�Zejejej�d
ddd
�edd��Zdefd��YZejd��Zd�ZdS(i����Ni(tauthtconfigt	constantsterrorst
http_utilstselinuxtutilss/usr/bin/gpgs/var/lib/kcare/gpgsrelease.content.jsonc	Cs�tj}|rtj}ntjr:tddd�}nt}xU|D]M}y|||�}PWqGtjk
r�}||dkr�|�q�qGXqGW||}t	j
||�|S(Ni����(RturlopenRturlopen_authRtFORCE_JSON_SIG_V3tSIG_VERIFY_ORDERRtNotFoundRtsave_to_file(	turltdsttdo_autht
urlopen_localtsig_extstsig_extt	signaturetnftsig_dst((s+/usr/libexec/kcare/python/kcarectl/fetch.pytfetch_signatures 		

cCs7tjjt�s3tjdjt�dd��ndS(Ns$No {0} present. Please install gnupgtstatussgnupg not found(tostpathtisfiletGPG_BINRt
KcareErrortformat(((s+/usr/libexec/kcare/python/kcarectl/fetch.pyt
check_gpg_bin)scCs
t�|jtj�r�tjjtd�}ytj	|||�Wq	tj
k
r~}tjdj
|t|����q	Xn�t|d��}|j�}WdQXtjjtd�}ytj|||�Wn4tk
r}tjdj
|t|����nXdS(s8
    Check a file signature using the gpg tool.
    If signature is wrong BadSignatureException will be raised.

    :param file_path: path to file which signature will be checked
    :param signature: a file with the signature
    :return: True in case of valid signature
    :raises: BadSignatureException
    sroot-keys.jsonsBad Signature: {0}: {1}trbNs
kcare_pub.key(RtendswithRtSIG_JSONRRtjointGPG_KEY_DIRtkcsig_verifytverifytErrorRtBadSignatureExceptionRtstrtopentreadtrun_gpg_verifyt	Exception(t	file_pathRt	root_keystetftsigdatatkeyring((s+/usr/libexec/kcare/python/kcarectl/fetch.pytcheck_gpg_signature.s
(tcountitdelayicCs�tj|�}tj|�}tj||�|rG|j||�n+|rrt||dt�}t	||�nt
j||�|S(NR(RRRtselinux_safe_tmpnameRRtcheckRtTrueR3Rtrename(R
Rtcheck_signaturethash_checkertresponsettmpR((s+/usr/libexec/kcare/python/kcarectl/fetch.pyt	fetch_urlMstHashCheckercBseZd�Zd�ZRS(cCsK||_tj|�jd�d|_tjtj|��d|_dS(Nt/tfiles(	tcontent_fileRtget_patch_server_urltrstript
url_prefixtjsontloadst	read_filethashes(tselftbaseurlRB((s+/usr/libexec/kcare/python/kcarectl/fetch.pyt__init__^s	cCs�|t|j�}||jkrItjdj||j�dd��ntjt	j
|��j�}|j|d}||kr�tjdj|||���ndS(Ns3Invalid checksum: {0} not found in content file {1}Rsinvalid checksumtsha256s<Invalid checksum: {0} has invalid checksum {1}, expected {2}(
tlenRERIRRRRBthashlibRMRt
read_file_bint	hexdigestR'(RJR
tfnametcfnamethshtexpected_hsh((s+/usr/libexec/kcare/python/kcarectl/fetch.pyR7cs(t__name__t
__module__RLR7(((s+/usr/libexec/kcare/python/kcarectl/fetch.pyR?]s	cCs�tjs
dS|jsdS|jt�}tjj|�s|y&t	t
j|jt�|tj�Wq|t
jk
rxdSXnt|j|�S(N(RtUSE_CONTENT_FILE_V3tNoneRKt
cache_pathtCONTENT_FILERRtexistsR>RRCt
USE_SIGNATURERRR?(tlevelR((s+/usr/libexec/kcare/python/kcarectl/fetch.pytget_hash_checkerts		&cs�fd�}|S(s=Enrich request with a cache key, and save it if response had.cs�tj�}|dk	rEd|kr1i|d<n||dtj<n�||�}|jjtj�}|dk	r�||kr�tjtj|�n|S(Ntheaders(	Rt
get_cache_keyRYRtCACHE_KEY_HEADERR`tgettatomic_writetCACHE_KEY_DUMP_PATH(targstkwargst	cache_keytrespt
new_cache_key(tclbl(s+/usr/libexec/kcare/python/kcarectl/fetch.pytwrapper�s
((RkRl((Rks+/usr/libexec/kcare/python/kcarectl/fetch.pytwrap_with_cache_key�s( RORFRR$tRRRRRRRtSIGR!R
RR#R[tFalseRRR3tretryt	check_excR'RYR>tobjectR?tcachedR_Rm(((s+/usr/libexec/kcare/python/kcarectl/fetch.pyt<module>s 4		$