%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�I�d@���ddlZddlmZddlmZddlmZddlZed�Z	dd�Z
d�Zdd�Zdd	�Z
d
�Zd�Zd�Zd
�Zd�Zy)�N)�nbt)�Net)�CommandErrorl����c��|}tjd|�}|r�|jd�}|jd�}|�C|j�}|j	�|j	�k7rtd|�d|�d���|j	�d|j
�fSd}tjd|�}|r||jd�}|jd�}|�X|j�}|jd	d�d
}|j	�|j	�k7rtd|�d|�d���|j	�|j
�dfS)
a get the realm or the domain and the base user
        from user like:
        * username
        * DOMAIN\username
        * username@REALM

         A SamDB object can also be passed in to check
        our domain or realm against the obtained ones.
    z
(\w+)\\(\w+$)��zGiven domain 'z' does not match our domain 'z'!�z(\w+)@(\w+)�.rz
Given realm 'z' does not match our realm ')	�re�match�group�domain_netbios_name�lowerr�upper�domain_dns_name�split)	�user�sam�baseuser�m�domain�
our_domain�realm�	our_realm�our_realm_initials	         �5/usr/lib/python3/dist-packages/samba/netcmd/common.py�_get_user_realm_domainrsW���H�
���!�4�(�A���������7�7�1�:���?��0�0�2�J��|�|�~��!1�!1�!3�3�"�^�F�8�<2�2<��R�$A�B�B���� �"�f�l�l�n�5�5��E�
�����&�A���7�7�1�:������
���?��+�+�-�I� )����Q� 7�� :���{�{�}� 1� 7� 7� 9�9�"�]�5�'�:-�-6�K�r�$;�<�<�
�N�N��e�k�k�m�R�0�0�c��|jd�j�dz|jd�j�zS)zkreturn the full DNS name of our own host. Used as a default
       for hostname when running status queriesznetbios namer
r)�getr)�lps r�netcmd_dnsnamer"Gs7���6�6�.�!�'�'�)�C�/�"�&�&��/�2G�2G�2I�I�Irc���t||��}|�|jd�}|j|tjtj
ztjz��}|jS)z�Return domain-name of a writable/ldap-capable DC for the default
       domain (parameter "realm" in smb.conf) unless another realm has been
       specified as argument��credsr!r)r�flags)rr �finddcr�NBT_SERVER_LDAP�
NBT_SERVER_DS�NBT_SERVER_WRITABLE�pdc_dns_name)r!r%r�net�	cldap_rets     r�
netcmd_finddcr.Msc���E�b�
!�C��}����w����
�
�%�!$�!4�!4�s�7H�7H�!H�3�Kb�Kb�!b��d�I��!�!�!rc��t||��}|j|tjtjz��}|S)zaReturn domain information (CLDAP record) of the ldap-capable
       DC with the specified addressr$)�addressr&)rr'rr(r))r!r%r0r,r-s     r�!netcmd_get_domain_infos_via_cldapr1Ys@���E�b�
!�C��
�
�7�!$�!4�!4�s�7H�7H�!H��J�I��rc�r�ddl}	t|�}|D]}|j|�ddk(s�yy#YyxYw)NrF�CT)�unicodedata�str�category)�valr4�str_val�cs    r�is_printable_attr_valr:asN�����c�(���������"�1�%��,�������s�2�6c�T�tj�}|j|_|j�D]O}|dk(r�	||}|||<d}|D]}t	|�r�d}n|r�.||jtj��Q|j|tj�}|S)N�dnFT)	�ldb�Messager<�keysr:�	set_flags�FLAG_FORCE_NO_BASE64_LDIF�
write_ldif�CHANGETYPE_NONE)�samdb�msgr�k�vals�need_base64�v�result_ldifs        r�get_ldif_for_editorrKss���	���
�A��6�6�A�D�
�X�X�Z�:����9���1�v����!�����	�A�$�Q�'���K��		�
�
�a�D�N�N�3�8�8�9�:��"�"�1�c�&9�&9�:�K��rc�V�t|�tk(rytt|��dzS)z8Converts a timestamp in -100 nanosecond units to minutesrg��A)�int�NEVER_TIMESTAMP�abs��
timestamp_strs r�timestamp_to_minsrR�s)��
�=��_�,���3�}�%�&�(�3�3rc��t|�dzS)z5Converts a timestamp in -100 nanosecond units to daysi�)rRrPs r�timestamp_to_daysrT�s���]�+�w�7�7rc��||vr||dS|S)z/get an attribute from a ldap msg with a defaultr�)rE�attrname�defaults   r�attr_defaultrY�s���3���8�}�Q����Nr)N)r�samba.dcerpcr�	samba.netr�samba.netcmdrr=rMrNrr"r.r1r:rKrRrTrYrVrr�<module>r]sR��(
���%�
��)�*��%1�PJ�	"���$�44�8�
r

Zerion Mini Shell 1.0