scripting: Correct parsing of binary DN
authorAndrew Bartlett <abartlet@samba.org>
Fri, 1 Mar 2013 06:29:09 +0000 (17:29 +1100)
committerStefan Metzmacher <metze@samba.org>
Mon, 4 Mar 2013 07:24:02 +0000 (08:24 +0100)
The DN is of the form B:8:01020304:DC=samba,DC=example,DC=com.  We need
to account for the case where the 8 is actually (say) 16, and so not just
one character.

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
python/samba/common.py

index e47f276..c2a3584 100644 (file)
@@ -81,7 +81,7 @@ class dsdb_Dn(object):
                 raise RuntimeError("Invalid DN %s" % dnstring)
             prefix_len = 4 + len(colons[1]) + int(colons[1])
             self.prefix = dnstring[0:prefix_len]
-            self.binary = self.prefix[4:-1]
+            self.binary = self.prefix[3+len(colons[1]):-1]
             self.dnstring = dnstring[prefix_len:]
         else:
             self.dnstring = dnstring