HEX
Server: LiteSpeed
System: Linux cpir1.prohostdns.com 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: pelakir (2976)
PHP: 8.2.31
Disabled: exec, shell_exec, system, passthru, proc_open, proc_close, proc_terminate, proc_get_status, popen, pclose, pcntl_exec
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/up2date_client/__pycache__/config.cpython-36.pyc
3

/V)j7�@sBdZddlZddlZddlZddlZddlmZmZddlm	Z	m
Z
yddlmZm
Z
Wn$ek
r|ddlmZm
Z
YnXddlZejddd�Zeed	�s�eje_ejZd9d:d;d<d=d>d?d@dAdBdCdDdEddd d!gfd"�Zd#dd$gZGd%d&�d&�ZGd'd(�d(�Zd)d*�Zd+d,�Zd-d.�ZdFd0d1�ZdGd2d3�ZdHd4d5�ZdId7d8�Z dS)Jzj
This module includes the Config and Up2date Config classes use by the
up2date agent to hold config info.
�N)�idn_ascii_to_puny�idn_puny_to_unicode)�ustr�sstr)�urlsplit�
urlunsplitzrhn-client-toolsT)Zfallback�ugettext�Use a HTTP Proxy�Remote server URL�)https://xmlrpc.cln.cloudlinux.com/XMLRPC/�&Remote server URL for access over IPv6�.https://ipv6.xmlrpc.cln.cloudlinux.com/XMLRPC/�Mirror list URL�>https://repo.cloudlinux.com/cloudlinux/mirrorlists/cln-mirrors�#Whether or not debugging is enabled�Location of system id�/etc/sysconfig/rhn/systemid�4Override the automatically determined system version��;HTTP proxy in host:port format, e.g. squid.example.com:3128�'The username for an authenticated proxy�.The password to use for an authenticated proxy�$To use an authenticated proxy or not�BNumber of attempts to make at network connections before giving up��)The CA cert used to verify the ssl server�'/usr/share/rhn/CLN-ORG-TRUSTED-SSL-CERTzDConfig options that can not be overwritten by a config update action�	sslCACert�	serverURL�disallowConfChanges)ZenableProxyr�
serverURLipv6Z	mirrorURL�debug�systemIdPathZversionOverride�	httpProxy�	proxyUser�
proxyPasswordZenableProxyAuthZnetworkRetriesrrr"ZtmpDirc@sleZdZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
ConfigFilez;class for handling persistent config options for the clientNcCsi|_||_|jr|j�dS)N)�dict�fileName�load)�self�filename�r,�/usr/lib/python3.6/config.py�__init__BszConfigFile.__init__cCs�|r
||_|jdkrdStj|jtj�s,dSt|jd�}d}�x�|j�D�]�}|jd�dkr^qH||j�}|spqH|ddkr�|dd�j�}qHnd}|jdd�}t	|�dkr�qH|dj�}t
|dj��}d}|jd	�}	|	dkr�|d|	�}|}d}|�rx|jd
�}
|dk�r"t|jt
j���}nVt	|
�dk�rVyt|�}Wntk
�rRYnXn"|
ddk�rjg}nd
d�|
D�}||f}||jk�r�|j|}|dk	�r�||df}|dk	�r�|d|f}||j|<qHW|j�dS)N�rr�#rr�\�=�z	[comment]�;r$r%cSsg|]}|j�r|j��qSr,)�strip)�.0�valr,r,r-�
<listcomp>�sz#ConfigFile.load.<locals>.<listcomp>���r9r9)r$r%)r(�os�access�R_OK�open�	readlines�findr5�split�lenrr�encode�locale�getpreferredencoding�int�
ValueErrorr'�close)r*r+�fZ	multiline�liner@�key�value�comment�pos�valuesZnewvalr,r,r-r)Hsd






zConfigFile.loadcCs�|jdkrdStj|jtj�sTtjtjj|j�tj�sTttdtjj|j���dStj|jdtj	tj
BtjBtjBtj
Bd�}ytj|d�tj|d�}Wn tk
r�tj|��YnX|jd�|jd�|jd�x�|jj�D]�}|j|\}}|jtd||f��t|�tg�k�r*|g}|tk�rBttjj|�}|jtd	|d
jtt|��f��|jd�q�W|j�tj|jd|j�dS)Nz%s was not foundz.newi��wzI# Automatically generated Red Hat Update Agent config file, do not edit.
z# Format: 1.0
rz%s[comment]=%s
z%s=%s
r4�
)r(r:r;r<�path�dirname�print�_r=�O_WRONLY�O_CREAT�O_TRUNC�
O_NOFOLLOW�	O_CLOEXEC�fchmod�fdopen�	ExceptionrG�writer'�keysr�type�FileOptions�map�abspath�join�str�rename)r*�fdrHrJrLrKr,r,r-�save�s<
	




"zConfigFile.savecCs
||jkS)N)r')r*�namer,r,r-�__contains__�szConfigFile.__contains__cCs||kS)Nr,)r*rhr,r,r-�has_key�szConfigFile.has_keycCs
|jj�S)N)r'r^)r*r,r,r-r^�szConfigFile.keyscCsdd�|jj�D�S)NcSsg|]}|d�qS)rr,)r6�ar,r,r-r8�sz%ConfigFile.values.<locals>.<listcomp>)r'rN)r*r,r,r-rN�szConfigFile.valuescCs|jj|�dS)N)r'�update)r*r'r,r,r-rl�szConfigFile.updatecCs||jkr|j|dSdS)Nr)r')r*rhr,r,r-�__getitem__�s
zConfigFile.__getitem__cCs0||jkr|j|}nd}|d|f|j|<dS)Nr)NN)r')r*rhrKr7r,r,r-�__setitem__�s
zConfigFile.__setitem__cCs||jkr|j|dSdS)Nrr)r')r*rhr,r,r-�info�s
zConfigFile.info)N)N)�__name__�
__module__�__qualname__�__doc__r.r)rgrirjr^rNrlrmrnror,r,r,r-r&?s

H0r&c@sveZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�ConfigNcCs.t�|_|jjt�|r$|jj|�i|_dS)N)r&�storedrl�Defaultsr)�runtime)r*r+r,r,r-r.�s
zConfig.__init__cCs ||jkrdS||jkrdSdS)NTF)rwru)r*rhr,r,r-ri�s


zConfig.__contains__cCs||kS)Nr,)r*rhr,r,r-rj�szConfig.has_keycCs8t|jj��}x$|jj�D]}||kr|j|�qW|S)N)�listrwr^ru�append)r*�ret�kr,r,r-r^�s
zConfig.keyscCs*g}x |j�D]}|j|j|��qW|S)N)r^ryrm)r*rzr{r,r,r-rNsz
Config.valuescCs.g}x$|j�D]}|j||j|�f�qW|S)N)r^ryrm)r*rzr{r,r,r-�items	szConfig.itemscCst|j��S)N)rAr^)r*r,r,r-�__len__szConfig.__len__cCs||j|<dS)N)rw)r*rhrKr,r,r-rnszConfig.__setitem__cCs,||jkr|j|S||jkr(|j|SdS)N)rwru)r*rhr,r,r-rms




zConfig.__getitem__cCs|jj|�S)N)ruro)r*rhr,r,r-roszConfig.infocCs|jj�dS)N)rurg)r*r,r,r-rg"szConfig.savecCs8|jj|�x&|jj�D]}||jkr(q|j|=qWdS)N)rur)r^rw)r*r+r{r,r,r-r)%s

zConfig.loadcCs ||j|<||jkr|j|=dS)N)rurw)r*rhrKr,r,r-�set/s

z
Config.set)N)rprqrrr.rirjr^rNr|r}rnrmrorgr)r~r,r,r,r-rt�s
		
rtcCs^t�}d}|d}|rZ|dd�dkr2|dd�}|jd�}tt|d��|d<dj|�}|S)zkreturns proxy string in format hostname:port
    hostname is converted to Punycode (RFC3492) if needed
    Nr#�zhttp://�:r)�initUp2dateConfigr@rdrrc)�cfg�proxyZ	proxyHost�partsr,r,r-�getProxySetting6s

r�cCs:t|�}tt|dtt|d��|d|d|df��S)z=returns url where hostname is converted to Punycode (RFC3492)rrr3��)rrrrr)Zurl�sr,r,r-�convert_url_to_punyHsr�cCs&t|t�rdd�|D�St|�gSdS)z�
    Internal function to process server URL to Punycode format.

    Processes both single URLs and lists of URLs.

    :param serverUrl: URL or list of URLs to process.
    :return: List of processed URLs in Punycode format.
    cSsg|]}t|��qSr,)r�)r6�ir,r,r-r8Xsz$processServerURL.<locals>.<listcomp>N)�
isinstancerxr�)Z	serverUrlr,r,r-�processServerURLNs	
r�FcCs^t�}t|d�}t|d�}||f}||f}|r6|Sddlm}|j�}|dkrZ|rZ|S|S)a�
    Return a pair of server URLs (primary and fallback) based on the preferred interface.

    :param registration: If True, it indicates that the URLs are being fetched for registration purposes.
    If that is the case, the function will always use IPv4 URLs with IPv6 as fallback,
    regardless of the preferred_interface setting.
    Assumed false by default, expected to be specified explicitly when needed.

    :return: Pair of server URL configs, first is the primary, second is the fallback.
    rr r)�up2dateAuthZIPv6)r�r�Zup2date_clientr�ZgetPreferredInterface)�registrationr�Zipv4_urlZipv6_urlZipv4_primary_pairZipv6_primary_pairr�Zpreferred_interfacer,r,r-�getServerURLPair]sr�cCst|d�dS)az
    Return the primary server URL from config based on preferred_interface.

    If preferred_interface=IPv6 in system_id, returns serverURLipv6 if available.
    Otherwise returns normal serverURL.
    Note: the config may have one value or a list of values, but this function always returns a list.

    :return: List of server URLs with hostnames converted to Punycode.
    )r�r)r�)r�r,r,r-�getServerURL�s
r�cCst|d�dS)z�
    Determine the fallback server URL from system_id.

    The fallback server URL is the one that is *not* set as preferred_interface.
    If preferred_interface is IPv6, it returns serverURL (i.e. IPv4 host), otherwise serverURLipv6.
    )r�r)r�)r�r,r,r-�getFallbackServerURL�sr��/etc/sysconfig/rhn/up2datecCsPytWntk
r daYnXtdkrLt|�adtd<tjj�rLdtd<tS)z<This function is the right way to get at the up2date config.NF�isattyT)r��	NameErrorrt�sys�stdoutr�)Zcfg_filer,r,r-r��s

r�)r	r)r
r)rr
)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)F)F)F)r�)!rsr:r�rCZrequestsZrhn.connectionsrrZrhn.i18nrrZurlparserr�ImportErrorZurllib.parse�gettextZtranslation�t�hasattrrrTrvr`r&rtr�r�r�r�r�r�r�r,r,r,r-�<module>sV
)O
'