ó
E®Uc           @   sZ   d  d l  Z  d  d l m Z d  d l m Z d „  Z d „  Z d d „ Z d d „ Z	 d S(   iÿÿÿÿN(   t   nbt(   t   Netc         C   s³   |  } d } d } t  j d |  ƒ } | ra | j d ƒ } | j d ƒ } | j ƒ  | j ƒ  | f St  j d |  ƒ } | rš | j d ƒ } | j d ƒ } n  | j ƒ  | | j ƒ  f S(   s‘    get the realm or the domain and the base user
        from user like:
        * username
        * DOMAIN\username
        * username@REALM
    t    s   (\w+)\\(\w+$)i   i   s   (\w+)@(\w+)(   t   ret   matcht   groupt   lowert   upper(   t   usert   baseusert   realmt   domaint   m(    (    s7   /usr/lib/python2.7/dist-packages/samba/netcmd/common.pyt   _get_user_realm_domain   s    c         C   s*   |  j  d ƒ j ƒ  d |  j  d ƒ j ƒ  S(   sk   return the full DNS name of our own host. Used as a default
       for hostname when running status queriess   netbios namet   .R
   (   t   getR   (   t   lp(    (    s7   /usr/lib/python2.7/dist-packages/samba/netcmd/common.pyt   netcmd_dnsname/   s    c         C   sc   t  d | d |  ƒ } | d k r3 |  j d ƒ } n  | j d | d t j t j Bt j Bƒ } | j S(   s©   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 argumentt   credsR   R
   R   t   flagsN(	   R   t   NoneR   t   finddcR    t   NBT_SERVER_LDAPt   NBT_SERVER_DSt   NBT_SERVER_WRITABLEt   pdc_dns_name(   R   R   R
   t   nett	   cldap_ret(    (    s7   /usr/lib/python2.7/dist-packages/samba/netcmd/common.pyt   netcmd_finddc5   s    c         C   s;   t  d | d |  ƒ } | j d | d t j t j Bƒ } | S(   sb   Return domain informations (CLDAP record) of the ldap-capable
       DC with the specified addressR   R   t   addressR   (   R   R   R    R   R   (   R   R   R   R   R   (    (    s7   /usr/lib/python2.7/dist-packages/samba/netcmd/common.pyt!   netcmd_get_domain_infos_via_cldapA   s    (
   R   t   samba.dcerpcR    t	   samba.netR   R   R   R   R   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/samba/netcmd/common.pyt   <module>   s   		