python/dsdb_dn: Add a generic get_bytes method on DNs
authorGarming Sam <garming@catalyst.net.nz>
Wed, 8 Mar 2017 04:17:27 +0000 (17:17 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 13 Mar 2017 04:10:10 +0000 (05:10 +0100)
Pair-programmed-with: Bob Campbell <bobcampbell@catalyst.net.nz>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/common.py

index c2a3584732ce8159bac175d4489645a346fe3e9a..20f170cf36e6f1715cda2c91e6c4c5a9d516e7b5 100644 (file)
@@ -19,6 +19,7 @@
 
 import ldb
 import dsdb
+import binascii
 
 
 def confirm(msg, forced=False, allow_all=False):
@@ -97,3 +98,7 @@ class dsdb_Dn(object):
         if self.prefix == '':
             return None
         return int(self.binary, 16)
+
+    def get_bytes(self):
+        '''return binary as a byte string'''
+        return binascii.unhexlify(self.binary)