mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s4/scripting/devel: py2/py3 compatability always decode result of b64encode
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
ff1920fb67
commit
bf95ecb35d
@ -74,7 +74,7 @@ savedcookie = cookie
|
|||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("Getting allusers with cookie")
|
print("Getting allusers with cookie")
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(samaccountname=*)", base=base, attrs=["objectClass"], controls=controls)
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
for ctl in ctrls:
|
for ctl in ctrls:
|
||||||
@ -88,7 +88,7 @@ if cookie.blob.extra_length > 0:
|
|||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("Getting all the entries")
|
print("Getting all the entries")
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
||||||
cont = 0
|
cont = 0
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
@ -105,7 +105,7 @@ else:
|
|||||||
bigusn = usn + 1000
|
bigusn = usn + 1000
|
||||||
while (cont == "1"):
|
while (cont == "1"):
|
||||||
print("")
|
print("")
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
for ctl in ctrls:
|
for ctl in ctrls:
|
||||||
@ -121,7 +121,7 @@ cookie.blob.highwatermark.tmp_highest_usn = usn - 2
|
|||||||
if cookie.blob.extra_length > 0:
|
if cookie.blob.extra_length > 0:
|
||||||
print("here")
|
print("here")
|
||||||
cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1
|
cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
for ctl in ctrls:
|
for ctl in ctrls:
|
||||||
@ -136,7 +136,7 @@ cookie.blob.highwatermark.tmp_highest_usn = usn - 2
|
|||||||
if cookie.blob.extra_length > 0:
|
if cookie.blob.extra_length > 0:
|
||||||
cookie.blob.extra.ctr.cursors[0].source_dsa_invocation_id = misc.GUID("128a99bf-e2df-4832-ac0a-1fb625e530db")
|
cookie.blob.extra.ctr.cursors[0].source_dsa_invocation_id = misc.GUID("128a99bf-e2df-4832-ac0a-1fb625e530db")
|
||||||
cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1
|
cookie.blob.extra.ctr.cursors[0].highest_usn = bigusn - 1
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8'))
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
for ctl in ctrls:
|
for ctl in ctrls:
|
||||||
@ -149,7 +149,7 @@ cookie.blob.highwatermark.highest_usn = 0
|
|||||||
cookie.blob.highwatermark.tmp_highest_usn = (usn - 2)
|
cookie.blob.highwatermark.tmp_highest_usn = (usn - 2)
|
||||||
if cookie.blob.extra_length > 0:
|
if cookie.blob.extra_length > 0:
|
||||||
cookie.blob.extra.ctr.cursors[0].highest_usn = (usn - 2)
|
cookie.blob.extra.ctr.cursors[0].highest_usn = (usn - 2)
|
||||||
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie))]
|
controls=["dirsync:1:1:50:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||||
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
(msgs, ctrls) = remote_ldb.searchex(expression="(objectclass=*)", base=base, controls=controls)
|
||||||
if (len(ctrls)):
|
if (len(ctrls)):
|
||||||
for ctl in ctrls:
|
for ctl in ctrls:
|
||||||
|
@ -91,7 +91,7 @@ class SpeedTest(samba.tests.TestCase):
|
|||||||
dn: """ + user_dn + """
|
dn: """ + user_dn + """
|
||||||
sAMAccountName: """ + user_dn.split(",")[0][3:] + """
|
sAMAccountName: """ + user_dn.split(",")[0][3:] + """
|
||||||
objectClass: user
|
objectClass: user
|
||||||
unicodePwd:: """ + base64.b64encode(("\"%s\"" % self.user_pass).encode('utf-16-le')) + """
|
unicodePwd:: """ + base64.b64encode(("\"%s\"" % self.user_pass).encode('utf-16-le')).decode('utf8') + """
|
||||||
url: www.example.com
|
url: www.example.com
|
||||||
"""
|
"""
|
||||||
self.ldb_admin.add_ldif(ldif)
|
self.ldb_admin.add_ldif(ldif)
|
||||||
|
Loading…
Reference in New Issue
Block a user