summaryrefslogtreecommitdiff
path: root/source4/scripting/python/samba/common.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-08-05 11:17:06 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-09 11:56:23 +0200
commitd994ef20567c1368f6bdea163d12ed3837f79a03 (patch)
tree9ad157c75c4db4965558d1b79fa680eb163c6ada /source4/scripting/python/samba/common.py
parent68d79eb6efb32eb3bc416ffc3430f0e4b1eed691 (diff)
downloadsamba-d994ef20567c1368f6bdea163d12ed3837f79a03.tar.gz
samba-d994ef20567c1368f6bdea163d12ed3837f79a03.tar.bz2
samba-d994ef20567c1368f6bdea163d12ed3837f79a03.zip
pysamdb: move normalise_int32() to common module
this will be needed in quite a few places
Diffstat (limited to 'source4/scripting/python/samba/common.py')
-rw-r--r--source4/scripting/python/samba/common.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/common.py b/source4/scripting/python/samba/common.py
index 6eeace5943..867f44a116 100644
--- a/source4/scripting/python/samba/common.py
+++ b/source4/scripting/python/samba/common.py
@@ -50,3 +50,8 @@ def confirm(msg, forced = False, allow_all=False):
print("Unknown response '%s'" % v)
+def normalise_int32(ivalue):
+ '''normalise a ldap integer to signed 32 bit'''
+ if int(ivalue) & 0x80000000:
+ return str(int(ivalue) - 0x100000000)
+ return str(ivalue)