diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-08-22 17:40:45 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-08-25 07:39:38 +1000 |
commit | 219271bd154817ccf0cb4706769e07eb5dfa11ee (patch) | |
tree | 35472f0936369e5be6b0f8552d65d4a74c87bfb4 /source4/scripting/python | |
parent | 5a9dc1d216fe419570891099fa7dd922bf025671 (diff) | |
download | samba-219271bd154817ccf0cb4706769e07eb5dfa11ee.tar.gz samba-219271bd154817ccf0cb4706769e07eb5dfa11ee.tar.bz2 samba-219271bd154817ccf0cb4706769e07eb5dfa11ee.zip |
s4-samdb: added host_dns_name(), domain_dns_name() and forest_dns_name()
these will make it easier to get python code right for multi-domain
support
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index f8369d6c5a..794479f425 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -574,6 +574,21 @@ accountExpires: %u """Get the server site name""" return dsdb._samdb_server_site_name(self) + def host_dns_name(self): + """return the DNS name of this host""" + res = self.search(base='', scope=ldb.SCOPE_BASE, attrs=['dNSHostName']) + return res[0]['dNSHostName'][0] + + def domain_dns_name(self): + """return the DNS name of the domain root""" + domain_dn = self.get_default_basedn() + return domain_dn.canonical_str().split('/')[0] + + def forest_dns_name(self): + """return the DNS name of the forest root""" + forest_dn = self.get_root_basedn() + return forest_dn.canonical_str().split('/')[0] + def load_partition_usn(self, base_dn): return dsdb._dsdb_load_partition_usn(self, base_dn) |