HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/ipapython/__pycache__/kernel_keyring.cpython-36.opt-1.pyc
3

�d[e'�@s�ddlmZddlZddlmZddlmZddlmZdZ	dZ
dd	�Zd
d�Zdd
�Z
ddd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)�)�absolute_importN)�run)�paths)�tasksz@s�usercCsttjdtgddd�}|jS)z
    Dump all keys
    �listFT)�
raiseonerr�capture_output)rr�KEYCTL�KEYRING�output)�result�r�$/usr/lib/python3.6/kernel_keyring.py�	dump_keys(srcCs6ttjdtt|gddd�}|jr,td|��|jj�S)zv
    One cannot request a key based on the description it was created with
    so find the one we're looking for.
    �searchFT)rr	zkey %s not found)	rrr
r�KEYTYPE�
returncode�
ValueError�
raw_output�rstrip)�keyr
rrr�get_real_key1s

rcCs4ttjdt|gddd�}|jr*td|��|jj�S)z�
    Fetches the value of a persistent key from storage, trimming trailing
    any tailing whitespace.

    Assert when key is not a string-type.
    Zget_persistentFT)rr	zpersistent key %s not found)rrr
rrrrr)rr
rrr�get_persistent_key>s

rTcCsF|rtj�dk	rdStj�}ytt|��Wntk
r@dSXdS)z�Returns True if the kernel persistent keyring is supported.

    If check_container is True and a containerized environment is detected,
    return False. There is no support for keyring namespace isolation yet.
    NFT)rZdetect_container�os�geteuidr�strr)Zcheck_containerZuidrrr�is_persistent_keyring_supportedMsrcCs&yt|�dStk
r dSXdS)zC
    Returns True/False whether the key exists in the keyring.
    TFN)rr)rrrr�has_key^s
rcCs8t|�}ttjd|gddd�}|jr2td|j��|jS)z�
    Read the keyring and return the value for key.

    Use pipe instead of print here to ensure we always get the raw data.
    �pipeFT)rr	zkeyctl pipe failed: %s)rrrr
rr�	error_logr)r�real_keyr
rrr�read_keyjsr"cCsJt|�r<t|�}ttjd|g|dd�}|jrFtd|j��n
t||�dS)zK
    Update the keyring data. If they key doesn't exist it is created.
    ZpupdateF)�stdinrzkeyctl pupdate failed: %sN)	rrrrr
rrr �add_key)r�valuer!r
rrr�
update_keyzsr&cCsFt|�rtd|��ttjdt|tg|dd�}|jrBtd|j��dS)z*
    Add a key to the kernel keyring.
    zkey %s already existsZpaddF)r#rzkeyctl padd failed: %sN)	rrrrr
rrrr )rr%r
rrrr$�s
r$cCs6t|�}ttjd|tgdd�}|jr2td|j��dS)z'
    Remove a key from the keyring
    �unlinkF)rzkeyctl unlink failed: %sN)rrrr
rrrr )rr!r
rrr�del_key�s
r()T)Z
__future__rrZipapython.ipautilrZipaplatform.pathsrZipaplatform.tasksrrrrrrrrr"r&r$r(rrrr�<module>s