From: Björn Baumbach Date: Wed, 24 Jan 2018 16:06:50 +0000 (+0100) Subject: python/samdb: add method normalize_dn_in_domain(): get full dn of an relative dn X-Git-Tag: tevent-0.9.36~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0a88be836b3b57e0b268d26350be419ef1aa4fdd;p=thirdparty%2Fsamba.git python/samdb: add method normalize_dn_in_domain(): get full dn of an relative dn Signed-off-by: Björn Baumbach Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/samdb.py b/python/samba/samdb.py index 82eb7a4ef4c..5b04c982673 100644 --- a/python/samba/samdb.py +++ b/python/samba/samdb.py @@ -997,3 +997,14 @@ accountExpires: %u def allocate_rid(self): '''return a new RID from the RID Pool on this DSA''' return dsdb._dsdb_allocate_rid(self) + + def normalize_dn_in_domain(self, dn): + """return full dn of an relative dn + + :param dn: relative dn + """ + domain_dn = ldb.Dn(self, self.domain_dn()) + full_dn = ldb.Dn(self, dn) + if not full_dn.is_child_of(domain_dn): + full_dn.add_base(domain_dn) + return full_dn