def get_dc_info(): res = netcmd_get_domain_infos_via_cldap(lp, None, '127.0.0.1') return { 'forest': res.forest, 'domain': res.dns_domain, 'domain_name': res.domain_name, 'pdc_dns_name': res.pdc_dns_name, 'pdc_name': res.pdc_name, 'server_site': res.server_site, 'client_site': res.client_site }
def run(self, address, credopts=None, sambaopts=None, versionopts=None): lp = sambaopts.get_loadparm() try: res = netcmd_get_domain_infos_via_cldap(lp, None, address) print "Forest : %s" % res.forest print "Domain : %s" % res.dns_domain print "Netbios domain : %s" % res.domain_name print "DC name : %s" % res.pdc_dns_name print "DC netbios name : %s" % res.pdc_name print "Server site : %s" % res.server_site print "Client site : %s" % res.client_site except RuntimeError: raise CommandError("Invalid IP address '" + address + "'!")
def run(self, address, credopts=None, sambaopts=None, versionopts=None): lp = sambaopts.get_loadparm() try: res = netcmd_get_domain_infos_via_cldap(lp, None, address) print "Forest : %s" % res.forest print "Domain : %s" % res.dns_domain print "Netbios domain : %s" % res.domain_name print "DC name : %s" % res.pdc_dns_name print "DC netbios name : %s" % res.pdc_name print "Server site : %s" % res.server_site print "Client site : %s" % res.client_site except RuntimeError: raise CommandError("Invalid IP address '" + address + "'!")
def get_domain(self): ''' Get current Active Directory domain name ''' dns_domainname = None try: # Get CLDAP record about domain # Look and python/samba/netcmd/domain.py for more examples res = netcmd_get_domain_infos_via_cldap(self.lp, None, self.selected_dc) dns_domainname = res.dns_domain logging.info(slogm('Found domain via CLDAP: {}'.format(dns_domainname))) except: logging.error(slogm('Unable to retrieve domain name via CLDAP query')) return dns_domainname
def get_domain(self): ''' Get current Active Directory domain name ''' dns_domainname = None try: # Get CLDAP record about domain # Look and python/samba/netcmd/domain.py for more examples res = netcmd_get_domain_infos_via_cldap(self.lp, None, self.selected_dc) dns_domainname = res.dns_domain logdata = dict({'domain': dns_domainname}) log('D18', logdata) except Exception as exc: log('E15') raise exc return dns_domainname
def get_cur_domain(): """Returns the domain name of the local Samba directory.""" res = netcmd_get_domain_infos_via_cldap(lp, None, '127.0.0.1') return res.dns_domain