File: //lib/python3/dist-packages/samba/netcmd/__pycache__/common.cpython-310.pyc
o
�/aS � @ s� d dl Z d dlmZ d dlmZ d dlZed�Zdd� Zdd� Z dd d
�Z
ddd�Zd
d� Zdd� Z
dd� Zdd� Zdd� ZdS )� N)�nbt)�Netl���� c C sx | }d}d}t �d| �}|r!|�d�}|�d�}|�� |�� |fS t �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_domain s
r c C s | � d��� d | � d��� S )zkreturn the full DNS name of our own host. Used as a default
for hostname when running status queriesznetbios name�.r )�getr
)�lpr r r �netcmd_dnsname4 s r c C s@ t || d�}|du r| �d�}|j|tjtjB tjB d�}|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 Nr )r �flags)r r �finddcr �NBT_SERVER_LDAP�
NBT_SERVER_DS�NBT_SERVER_WRITABLE�pdc_dns_name)r r r �net� cldap_retr r r �
netcmd_finddc: s
�r"