1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-08 04:58:40 +03:00

s4-pysamdb: fixed the normalisation of grouptype in group add

ldap integers are signed

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Jun 17 05:43:18 CEST 2011 on sn-devel-104
This commit is contained in:
Andrew Tridgell 2011-06-17 12:02:23 +10:00
parent a8269792aa
commit 0c3075cb57

View File

@ -142,7 +142,7 @@ pwdLastSet: 0
"objectClass": "group"}
if grouptype is not None:
ldbmessage["groupType"] = "%d" % grouptype
ldbmessage["groupType"] = self.normalise_int32(grouptype)
if description is not None:
ldbmessage["description"] = description
@ -722,3 +722,9 @@ accountExpires: %u
if sd:
m["nTSecurityDescriptor"] = ndr_pack(sd)
self.add(m)
def normalise_int32(self, ivalue):
'''normalise a ldap integer to signed 32 bit'''
if int(ivalue) & 0x80000000:
return str(int(ivalue) - 0x100000000)
return str(ivalue)