%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/samba/samba3/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/samba/samba3/__pycache__/__init__.cpython-312.pyc

�

�I�d�/��.�dZdZdZdZddlZddlZddlZddlmZddlm	Z
ddlmZd	�Z
d
�ZGd�de�ZGd
�de�ZdZdZdZdZdZGd�de�ZGd�de�ZdZdZGd�de�ZGd�de�Zd�ZGd�de�ZGd�d e�Zy)!z'Support for reading Samba 3 data files.�restructuredTextsSAMBA_REGVAL��N)�passdb)�param)�	get_bytesc�~�	||}t|�dk(sJ�tjd|�dS#t$rYywxYw)N��<Lr��KeyError�len�struct�unpack��db�key�datas   �7/usr/lib/python3/dist-packages/samba/samba3/__init__.py�fetch_uint32r!�L����#�w���t�9��>��>��=�=��t�$�Q�'�'��������0�	<�<c�~�	||}t|�dk(sJ�tjd|�dS#t$rYywxYw)Nr	z<lrrrs   r�fetch_int32r*rrc�"�eZdZdZd�Zd�Zd�Zy)�
DbDatabasez#Simple Samba 3 TDB database reader.c�~�tj|dztj��|_|j�y)z^Open a file.

        :param file: Path of the file to open, appending .tdb or .ntdb.
        z.tdb)�flagsN)�tdb�Tdb�os�O_RDONLYr�_check_version)�self�files  r�__init__zDbDatabase.__init__5s*��
�'�'�$��-�r�{�{�;�������c��y�N��r#s rr"zDbDatabase._check_version=���r&c�8�|jj�y)z,Close resources associated with this object.N)r�closer*s rr-zDbDatabase.close@s�����
�
�r&N)�__name__�
__module__�__qualname__�__doc__r%r"r-r)r&rrr3s��-��
�r&rc�(�eZdZdZd�Zd�Zd�Zd�Zy)�Registrya3Simple read-only support for reading the Samba3 registry.

    :note: This object uses the same syntax for registry key paths as
        Samba 3. This particular format uses forward slashes for key path
        separators and abbreviations for the predefined key names.
        e.g.: HKLM/Software/Bar.
    c�4�t|j��S)zReturn the number of keys.)r
�keysr*s r�__len__zRegistry.__len__Ms���4�9�9�;��r&c��|jD�cgc])}|jt�r�|jd���+c}Scc}w)zReturn list with all the keys.�)r�
startswith�REGISTRY_VALUE_PREFIX�rstrip�r#�ks  rr5z
Registry.keysQs/��+/�7�7�^�a�!�,�,�G\�:]�����!�^�^��^s
�A�Ac��|jj|dz�}|�gStjd|dd�\}|ddj	d�}|ddk(sJ�|j�t
|�|k(sJ�|S)zxRetrieve the subkeys for the specified key.

        :param key: Key path.
        :return: list with key names
        r8Nr
rr	���r&)r�getrr�split�popr
)r#rr�numr5s     r�subkeyszRegistry.subkeysUs����w�w�{�{�3��=�)���<��I��-�-��d�1�Q�i�0����A�B�x�~�~�e�$���B�x�3�������
��4�y�C�����r&c��|jjtdz|zdz�}|�iSi}tjd|dd�\}|dd}t|�D]f}|j
dd�\}}tjd|dd�\}|dd}tjd|dd�\}|dd}||d|f||<||d}�h|S)z�Return a dictionary with the values set for a specific key.

        :param key: Key to retrieve values for.
        :return: Dictionary with value names as key, tuple with type and
            data as value.�/r8Nr
rr	r)rr@r:rr�rangerA)	r#rr�retrC�i�name�type�	value_lens	         r�valueszRegistry.valueses����w�w�{�{�0�4�7�#�=��G�H���<��I����-�-��d�1�Q�i�0����A�B�x���s��
	$�A��:�:�e�Q�/�L�T�4��}�}�T�4��!�9�5�H�T����8�D�"�M�M�$��Q�q�	�:�M�Y����8�D��t�J�Y�/�0�C��I��	�
�#�D�
	$��
r&N)r.r/r0r1r6r5rDrMr)r&rr3r3Es��� �_�� r&r3s
GROUP HWMs	USER HWMsGID sUID �c�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�
IdmapDatabasezSamba 3 ID map database reader.c�B�t|jd�tk(sJ�y)NsIDMAP_VERSION)rr�IDMAP_VERSION_V2r*s rr"zIdmapDatabase._check_version�s���4�7�7�$6�7�;K�K�K�Kr&c#�K�|jD]q}|jt�r"|jd�j	d���|jt
�s�P|jd�j	d����sy�w)z,Retrieve a list of all ids in this database.r8� N)rr9�IDMAP_USER_PREFIXr;rA�IDMAP_GROUP_PREFIXr<s  r�idszIdmapDatabase.ids�se�������	2�A��|�|�-�.��h�h�u�o�+�+�D�1�1��|�|�.�/��h�h�u�o�+�+�D�1�1�		2�s�AB�%Bc#�K�|jD]D}|jt�s�t|t	t�djd�����Fy�w)z-Retrieve a list of all uids in this database.Nr8)rr9rU�intr
r;r<s  r�uidszIdmapDatabase.uids�sL�������	D�A��|�|�-�.��!�C� 1�2�3�4�;�;�E�B�C�C�	D��
�%A�/Ac#�K�|jD]D}|jt�s�t|t	t�djd�����Fy�w)z-Retrieve a list of all gids in this database.Nr8)rr9rVrYr
r;r<s  r�gidszIdmapDatabase.gids�sL�������	E�A��|�|�.�/��!�C� 2�3�4�5�<�<�U�C�D�D�	E�r[c	��|jjt|�dt|��d���}|�|S|j	d�S)z�Retrieve SID associated with a particular id and type.

        :param xid: UID or GID to retrieve SID for.
        :param id_type: Type of id specified - 'UID' or 'GID'
        � �)rr@r�strr;)r#�xid�id_typers    r�get_sidzIdmapDatabase.get_sid�s=���w�w�{�{�9�'�3�s�8�%D�E�F���<��K��{�{�4� � r&c��|jjtt|�j	�zdz�}|�|S|jd�S)z�Retrieve the SID associated with a particular uid.

        :param uid: UID to retrieve SID for.
        :return: A SID or None if no mapping was found.
        r8)rr@rUra�encoder;)r#�uidrs   r�get_user_sidzIdmapDatabase.get_user_sid�sE���w�w�{�{�,�s�3�x���/@�@�5�H�I���<��K��{�{�5�!�!r&c��|jjtt|�j	�zdz�}|�|S|jd�S)Nr8)rr@rVrarfr;)r#�gidrs   r�
get_group_sidzIdmapDatabase.get_group_sid�sC���w�w�{�{�-��C����0A�A�E�I�J���<��K��{�{�5�!�!r&c�6�t|jt�S)z Obtain the user high-water mark.)rr�IDMAP_HWM_USERr*s r�get_user_hwmzIdmapDatabase.get_user_hwm�s���D�G�G�^�4�4r&c�6�t|jt�S)z!Obtain the group high-water mark.)rr�IDMAP_HWM_GROUPr*s r�
get_group_hwmzIdmapDatabase.get_group_hwm�s���D�G�G�_�5�5r&N)
r.r/r0r1r"rWrZr]rdrhrkrnrqr)r&rrPrP�s5��)�L�2�D�E�	!�	"�"�5�6r&rPc�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�SecretsDatabasez Samba 3 Secrets database reader.c�8�|jjd�S)NsSECRETS/AUTH_PASSWORD�rr@r*s r�get_auth_passwordz!SecretsDatabase.get_auth_password�s���w�w�{�{�3�4�4r&c�8�|jjd�S)NsSECRETS/AUTH_DOMAINrur*s r�get_auth_domainzSecretsDatabase.get_auth_domain�s���w�w�{�{�1�2�2r&c�8�|jjd�S)NsSECRETS/AUTH_USERrur*s r�
get_auth_userzSecretsDatabase.get_auth_user�s���w�w�{�{�/�0�0r&c�>�|jjd|z�S)NsSECRETS/DOMGUID/%sru�r#�hosts  r�get_domain_guidzSecretsDatabase.get_domain_guid�s���w�w�{�{�0�4�7�8�8r&c#�K�|jD]3}|jd�s�|td�djd����5y�w)NzSECRETS/LDAP_BIND_PW/r`�rr9r
r;r<s  r�ldap_dnszSecretsDatabase.ldap_dns�sG�������	D�A��|�|�3�4���3�4�5�6�=�=�d�C�C�	D��
�!A�"Ac#�K�|jD]3}|jd�s�|td�djd����5y�w)zvIterate over domains in this database.

        :return: Iterator over the names of domains in this database.
        zSECRETS/SID/Nr`r�r<s  r�domainszSecretsDatabase.domains�sE����
���	;�A��|�|�N�+���N�+�,�-�4�4�T�:�:�	;�r�c�P�|jjtd|z��S)NzSECRETS/LDAP_BIND_PW/%s�rr@rr|s  r�get_ldap_bind_pwz SecretsDatabase.get_ldap_bind_pw�� ���w�w�{�{�9�%>��%E�F�G�Gr&c�P�|jjtd|z��S)NzSECRETS/AFS_KEYFILE/%sr�r|s  r�get_afs_keyfilezSecretsDatabase.get_afs_keyfile�s ���w�w�{�{�9�%=��%D�E�F�Fr&c�F�t|jtd|z��S)Nz#SECRETS/MACHINE_SEC_CHANNEL_TYPE/%s)rrrr|s  r�get_machine_sec_channel_typez,SecretsDatabase.get_machine_sec_channel_type�s���D�G�G�Y�/T�W[�/[�%\�]�]r&c�4�t|jd|z�S)Nz#SECRETS/MACHINE_LAST_CHANGE_TIME/%s)rrr|s  r�get_machine_last_change_timez,SecretsDatabase.get_machine_last_change_time�s���D�G�G�%J�T�%Q�R�Rr&c�P�|jjtd|z��S)NzSECRETS/MACHINE_PASSWORD/%sr�r|s  r�get_machine_passwordz$SecretsDatabase.get_machine_password�s ���w�w�{�{�9�%B�T�%I�J�K�Kr&c�P�|jjtd|z��S)NzSECRETS/$MACHINE.ACC/%sr�r|s  r�get_machine_acczSecretsDatabase.get_machine_acc�r�r&c�P�|jjtd|z��S)NzSECRETS/$DOMTRUST.ACC/%sr�r|s  r�get_domtrust_accz SecretsDatabase.get_domtrust_acc�s ���w�w�{�{�9�%?�$�%F�G�H�Hr&c#�K�|jD]3}|jd�s�|td�djd����5y�w)NzSECRETS/$DOMTRUST.ACC/r`r�r<s  r�trusted_domainszSecretsDatabase.trusted_domains�sG�������	E�A��|�|�4�5���4�5�6�7�>�>�t�D�D�	E�r�c�8�|jjd�S)NsINFO/random_seedrur*s r�get_random_seedzSecretsDatabase.get_random_seeds���w�w�{�{�.�/�/r&c�l�|jjtd|j�z��S)NzSECRETS/SID/%s)rr@r�upperr|s  rrdzSecretsDatabase.get_sids&���w�w�{�{�9�%5��
�
��%D�E�F�Fr&N)r.r/r0r1rvrxrzr~r�r�r�r�r�r�r�r�r�r�r�rdr)r&rrsrs�s_��*�5�3�1�9�D�
;�H�G�^�S�L�H�I�E�
0�Gr&rsc��eZdZdZd�Zd�Zy)�ShareInfoDatabasez#Samba 3 Share Info database reader.c�L�t|jd�ttfvsJ�y)Nz
INFO/version)rr�SHARE_DATABASE_VERSION_V1�SHARE_DATABASE_VERSION_V2r*s rr"z ShareInfoDatabase._check_versions#���4�7�7�$4�5�:S�Un�9o�o�o�or&c�T�|jjtd|z��}|S)zfObtain the security descriptor on a particular share.

        :param name: Name of the share
        z
SECDESC/%sr�)r#rJ�secdescs   r�get_secdesczShareInfoDatabase.get_secdescs%��
�'�'�+�+�i��t�(;�<�=���r&N)r.r/r0r1r"r�r)r&rr�r�s��-�p�r&r�c�"�eZdZdZd�Zd�Zd�Zy)�ShareszContainer for share objects.c� �||_||_yr()�lp�	shareinfo)r#r�r�s   rr%zShares.__init__s�����"��r&c�2�t|j�dz
S)zNumber of shares.r)r
r�r*s rr6zShares.__len__"s���4�7�7�|�a��r&c�6�|jj�S)zIterate over the share names.)r��__iter__r*s rr�zShares.__iter__&s���w�w���!�!r&N)r.r/r0r1r%r6r�r)r&rr�r�s��&�#� �"r&r�c��t�}d}d}|D]/}|dk(r|}�|dvr|s|dk7r|j|�d}�+||z
}�1|dk7r|j|�|S)z�Very simple shell-like line splitting.

    :param text: Text to split.
    :return: List with parts of the line as strings.
    F��")�	�
r_)�list�append)�textrH�inquotes�current�cs     r�
shellsplitr�+sx���&�C��H��G�
�����9�#�|�H�
�#�
#�H��"�}��
�
�7�#��G��q�L�G���"�}��
�
�7���Jr&c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�WinsDatabasezSamba 3 WINS database reader.c��i|_t|d�}|j�jd�dk(sJ�|j	�D]�}|ddk(r�t|jd��}|d}t
|d�}d}g}d||vr!|j||�|dz
}d||vr�!t
||dd	d
�}	||jvs
Jd|z��|||	f|j|<��|j�y)N�rr�zVERSION 1 0r�#rrN�.r?�zName %s exists twice)	�entries�open�readliner;�	readlinesr�rYr�r-)
r#r$�f�lr�rJ�ttlrI�ips�nb_flagss
          rr%zWinsDatabase.__init__Ds�������s�O���z�z�|�"�"�4�(�M�9�9�9�����
	6�A���t�s�{�� ����$��0�G��1�:�D��g�a�j�/�C��A��C�����#��
�
�7�1�:�&��Q�������#��7�1�:�c�r�?�B�/�H��t�|�|�+�J�-C�d�-J�J�+�"%�s�H�!5�D�L�L���
	6�	
���	r&c� �|j|Sr()r�)r#rJs  r�__getitem__zWinsDatabase.__getitem__Xs���|�|�D�!�!r&c�,�t|j�Sr()r
r�r*s rr6zWinsDatabase.__len__[s���4�<�<� � r&c�,�t|j�Sr()�iterr�r*s rr�zWinsDatabase.__iter__^s���D�L�L�!�!r&c�6�|jj�S)z)Return the entries in this WINS database.)r��itemsr*s rr�zWinsDatabase.itemsas���|�|�!�!�#�#r&c��yr(r)r*s rr-zWinsDatabase.closeer+r&N)
r.r/r0r1r%r�r6r�r�r-r)r&rr�r�Bs#��'��("�!�"�$�
r&r�c�T�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zy)�Samba3z,Samba 3 configuration and state data reader.Nc��||_|r||_ytj�|_|jj	|�y)z�Open the configuration and data for a Samba 3 installation.

        :param smbconfpath: Path to the smb.conf file.
        :param s3_lp_ctx: Samba3 Loadparm context
        N)�smbconfpathr��s3param�get_context�load)r#r��	s3_lp_ctxs   rr%zSamba3.__init__ls6��'�����D�G��)�)�+�D�G��G�G�L�L��%r&c��|ddk(s|ddk(r|Stjj|jj	d�|�S)Nr�/r�zstate directory�r �path�joinr�r@�r#r�s  r�
statedir_pathzSamba3.statedir_pathys?����7�c�>�T�!�W��^��K��w�w�|�|�D�G�G�K�K�(9�:�D�A�Ar&c��|ddk(s|ddk(r|Stjj|jj	d�|�S)Nrr�r�zprivate dirr�r�s  r�privatedir_pathzSamba3.privatedir_path~s>����7�c�>�T�!�W��^��K��w�w�|�|�D�G�G�K�K�
�6��=�=r&c��|jSr()r�r*s r�get_confzSamba3.get_conf�s���w�w�r&c�^�tj|jjd��S)Nzpassdb backend)r�PDBr�r@r*s r�
get_sam_dbzSamba3.get_sam_db�s���z�z�$�'�'�+�+�&6�7�8�8r&c�6�t|jd��S)N�registry)r3r�r*s r�get_registryzSamba3.get_registry�s����*�*�:�6�7�7r&c�6�t|jd��S)N�secrets)rsr�r*s r�get_secrets_dbzSamba3.get_secrets_db�s���t�3�3�I�>�?�?r&c�6�t|jd��S)N�
share_info)r�r�r*s r�get_shareinfo_dbzSamba3.get_shareinfo_db�s�� ��!3�!3�L�!A�B�Br&c�6�t|jd��S)N�winbindd_idmap)rPr�r*s r�get_idmap_dbzSamba3.get_idmap_db�s���T�/�/�0@�A�B�Br&c�6�t|jd��S)Nzwins.dat)r�r�r*s r�get_wins_dbzSamba3.get_wins_db�s���D�.�.�z�:�;�;r&c�R�t|j�|j��Sr()r�r�r�r*s r�
get_shareszSamba3.get_shares�s���d�m�m�o�t�'<�'<�'>�?�?r&r()r.r/r0r1r%r�r�r�r�r�r�r�r�r�r�r)r&rr�r�isA��6�&�B�
>�
�9�8�@�C�C�<�@r&r�) r1�
__docformat__r:�REGISTRY_DB_VERSIONr rr�samba.samba3rrr��samba.commonrrr�objectrr3rprmrVrUrRrPrsr�r�r�r�r�r�r�r)r&r�<module>r�s���$.�"�
�'����	�
�
��)�"�(�(����$8�z�8�x!����������<6�J�<6�~;G�j�;G�|����
�
�
� "�V�"��.$
�6�$
�N0@�V�0@r&

Zerion Mini Shell 1.0