summaryrefslogtreecommitdiff
path: root/python/samba/samba3
diff options
context:
space:
mode:
authorJoe Guo <joeg@catalyst.net.nz>2018-03-28 15:08:40 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-04-05 08:59:09 +0200
commitfe9e62935c459e4cdab0cefea1412614dd1969a8 (patch)
treea5cb53d99e04575f214588ab97d6f09701382277 /python/samba/samba3
parent2d593c27fd4f7162f5f71f97d44a4fe286d53ff5 (diff)
downloadsamba-fe9e62935c459e4cdab0cefea1412614dd1969a8.tar.gz
samba3: work around bytes formatting for Python 3.4
b'%s\x00' % key The above % formatting for bytes is only available since Python 3.5, however we need to support Python 3.4 so far. Work around this with `+`. Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python/samba/samba3')
-rw-r--r--python/samba/samba3/__init__.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/samba/samba3/__init__.py b/python/samba/samba3/__init__.py
index a0bb76f68c1..f7927836c98 100644
--- a/python/samba/samba3/__init__.py
+++ b/python/samba/samba3/__init__.py
@@ -87,7 +87,7 @@ class Registry(DbDatabase):
:param key: Key path.
:return: list with key names
"""
- data = self.db.get(b"%s\x00" % key)
+ data = self.db.get(key + b"\x00")
if data is None:
return []
(num, ) = struct.unpack("<L", data[0:4])
@@ -103,7 +103,7 @@ class Registry(DbDatabase):
:param key: Key to retrieve values for.
:return: Dictionary with value names as key, tuple with type and
data as value."""
- data = self.db.get(b"%s/%s\x00" % (REGISTRY_VALUE_PREFIX, key))
+ data = self.db.get(REGISTRY_VALUE_PREFIX + b'/' + key + b'\x00')
if data is None:
return {}
ret = {}
@@ -177,13 +177,13 @@ class IdmapDatabase(DbDatabase):
:param uid: UID to retrieve SID for.
:return: A SID or None if no mapping was found.
"""
- data = self.db.get(b"%s%d\0" % (IDMAP_USER_PREFIX, uid))
+ data = self.db.get(IDMAP_USER_PREFIX + str(uid).encode() + b'\0')
if data is None:
return data
return data.rstrip(b"\0")
def get_group_sid(self, gid):
- data = self.db.get(b"%s%d\0" % (IDMAP_GROUP_PREFIX, gid))
+ data = self.db.get(IDMAP_GROUP_PREFIX + str(gid).encode() + b'\0')
if data is None:
return data
return data.rstrip(b"\0")