HEX
Server: LiteSpeed
System: Linux shams.tasjeel.ae 5.14.0-611.5.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 08:09:09 EST 2025 x86_64
User: infowars (1469)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib/python3.9/site-packages/ipapython/__pycache__/kernel_keyring.cpython-39.pyc
a

}�f'�@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��
raiseonerrZcapture_output)rr�KEYCTL�KEYRING�output)�result�r�</usr/lib/python3.9/site-packages/ipapython/kernel_keyring.py�	dump_keys(s�rcCsDt|t�sJ�ttjdtt|gddd�}|jr:td|��|j	�
�S)zv
    One cannot request a key based on the description it was created with
    so find the one we're looking for.
    �searchFTrzkey %s not found)�
isinstance�strrrr
r�KEYTYPE�
returncode�
ValueError�
raw_output�rstrip��keyr
rrr�get_real_key1s�rcCsBt|t�sJ�ttjdt|gddd�}|jr8td|��|j�	�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_persistentFTrzpersistent key %s not found)
rrrrr
rrrrrrrrr�get_persistent_key>s�rTcCsF|rt��durdSt��}ztt|��Wnty@YdS0dS)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�geteuidrrr)Zcheck_container�uidrrr�is_persistent_keyring_supportedMsr cCs6t|t�sJ�zt|�WdSty0YdS0dS)zC
    Returns True/False whether the key exists in the keyring.
    TFN)rrrr)rrrr�has_key^sr!cCsFt|t�sJ�t|�}ttjd|gddd�}|jr@td|j��|j	S)z�
    Read the keyring and return the value for key.

    Use pipe instead of print here to ensure we always get the raw data.
    �pipeFTrzkeyctl pipe failed: %s)
rrrrrr
rr�	error_logr�r�real_keyr
rrr�read_keyjs�r&cCsft|t�sJ�t|t�sJ�t|�rXt|�}ttjd|g|dd�}|jrbt	d|j
��n
t||�dS)zK
    Update the keyring data. If they key doesn't exist it is created.
    ZpupdateF��stdinr	zkeyctl pupdate failed: %sN)rr�bytesr!rrrr
rrr#�add_key)r�valuer%r
rrr�
update_keyzs�r,cCsbt|t�sJ�t|t�sJ�t|�r0td|��ttjdt|t	g|dd�}|j
r^td|j��dS)z*
    Add a key to the kernel keyring.
    zkey %s already existsZpaddFr'zkeyctl padd failed: %sN)rrr)r!rrrr
rrrr#)rr+r
rrrr*�s�r*cCsDt|t�sJ�t|�}ttjd|tgdd�}|jr@td|j	��dS)z'
    Remove a key from the keyring
    �unlinkF)r	zkeyctl unlink failed: %sN)
rrrrrr
rrrr#r$rrr�del_key�s�r.)T)Z
__future__rrZipapython.ipautilrZipaplatform.pathsrZipaplatform.tasksrrrrrrr r!r&r,r*r.rrrr�<module>s