HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/samba/netcmd/__pycache__/common.cpython-310.pyc
o

�/aS�@s�ddlZddlmZddlmZddlZed�Zdd�Zdd�Z	dd	d
�Z
ddd�Zd
d�Zdd�Z
dd�Zdd�Zdd�ZdS)�N)�nbt)�Netl����cCsx|}d}d}t�d|�}|r!|�d�}|�d�}|��|��|fSt�d|�}|r3|�d�}|�d�}|��||��fS)z� get the realm or the domain and the base user
        from user like:
        * username
        * DOMAIN\username
        * username@REALM
    �z
(\w+)\\(\w+$)��z(\w+)@(\w+))�re�match�group�lower�upper)�user�baseuser�realm�domain�m�r�5/usr/lib/python3/dist-packages/samba/netcmd/common.py�_get_user_realm_domains



rcCs |�d���d|�d���S)zkreturn the full DNS name of our own host. Used as a default
       for hostname when running status queriesznetbios name�.r)�getr
)�lprrr�netcmd_dnsname4s rcCs@t||d�}|dur|�d�}|j|tjtjBtjBd�}|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��credsrNr)r�flags)rr�finddcr�NBT_SERVER_LDAP�
NBT_SERVER_DS�NBT_SERVER_WRITABLE�pdc_dns_name)rrr�net�	cldap_retrrr�
netcmd_finddc:s
�r"cCs&t||d�}|j|tjtjBd�}|S)zaReturn domain information (CLDAP record) of the ldap-capable
       DC with the specified addressr)�addressr)rrrrr)rrr#r r!rrr�!netcmd_get_domain_infos_via_cldapFs

�r$cCsHddl}zt|�}WnYdS|D]}|�|�ddkr!dSqdS)NrF�CT)�unicodedata�str�category)�valr&�str_val�crrr�is_printable_attr_valNs�r,cCszt��}|j|_|��D]'}|dkrq||}|||<d}|D]	}t|�r&qd}|s3||�tj�q|�|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_ldifrrr�get_ldif_for_editor`s$�r<cCs t|�tkrdStt|��dS)z8Converts a timestamp in -100 nanosecond units to minutesrg��A)�int�NEVER_TIMESTAMP�abs��
timestamp_strrrr�timestamp_to_minszsrBcCst|�dS)z5Converts a timestamp in -100 nanosecond units to daysi�)rBr@rrr�timestamp_to_days�srCcCs||vr
||dS|S)z/get an attribute from a ldap msg with a defaultrr)r6�attrname�defaultrrr�attr_default�srF)N)r�samba.dcerpcr�	samba.netrr.r=r>rrr"r$r,r<rBrCrFrrrr�<module>s