mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
s4/dsdb/tests: 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:
committed by
Andrew Bartlett
parent
bf95ecb35d
commit
6f30a0b5f1
@ -1375,9 +1375,9 @@ class AclCARTests(AclTests):
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
except LdbError as e24:
|
||||
(num, _) = e24.args
|
||||
@ -1402,9 +1402,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
except LdbError as e25:
|
||||
(num, _) = e25.args
|
||||
@ -1423,9 +1423,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
|
||||
def test_change_password5(self):
|
||||
@ -1503,18 +1503,18 @@ userPassword: thatsAcomplPASS2
|
||||
dn: """ + self.get_user_dn(self.user_with_pc) + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
#then someone else's
|
||||
self.ldb_user2.modify_ldif("""
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"samba123@\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
|
||||
def test_reset_password1(self):
|
||||
@ -1524,7 +1524,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
replace: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
except LdbError as e29:
|
||||
(num, _) = e29.args
|
||||
@ -1537,7 +1537,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le'))
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
replace: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
|
||||
def test_reset_password2(self):
|
||||
@ -1577,7 +1577,7 @@ userPassword: thatsAcomplPASS1
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
replace: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
except LdbError as e32:
|
||||
(num, _) = e32.args
|
||||
@ -1610,7 +1610,7 @@ userPassword: thatsAcomplPASS1
|
||||
dn: """ + self.get_user_dn(self.user_with_wp) + """
|
||||
changetype: modify
|
||||
replace: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
|
||||
def test_reset_password6(self):
|
||||
|
@ -582,7 +582,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
|
||||
ctl = str(res.controls[0]).split(":")
|
||||
cookie = ndr_unpack(drsblobs.ldapControlDirSyncCookie, base64.b64decode(str(ctl[4])))
|
||||
cookie.blob.guid1 = misc.GUID("128a99bf-abcd-1234-abcd-1fb625e530db")
|
||||
controls=["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie))]
|
||||
controls=["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
|
||||
res = self.ldb_admin.search(self.base_dn,
|
||||
expression="(&(objectClass=organizationalUnit)(!(isDeleted=*)))",
|
||||
controls=controls)
|
||||
|
@ -2853,7 +2853,7 @@ nTSecurityDescriptor: """ + sddl)
|
||||
sddl = "O:DUG:DUD:PAI(A;;RPWP;;;AU)S:PAI"
|
||||
desc = security.descriptor.from_sddl(sddl, self.domain_sid)
|
||||
desc_binary = ndr_pack(desc)
|
||||
desc_base64 = base64.b64encode(desc_binary)
|
||||
desc_base64 = base64.b64encode(desc_binary).decode('utf8')
|
||||
self.ldb.add_ldif("""
|
||||
dn: """ + user_dn + """
|
||||
objectclass: user
|
||||
@ -2877,7 +2877,7 @@ nTSecurityDescriptor:: """ + desc_base64)
|
||||
try:
|
||||
sddl = "O:DUG:DUD:AI(A;;RPWP;;;AU)S:PAI"
|
||||
desc = security.descriptor.from_sddl(sddl, security.dom_sid('S-1-5-21'))
|
||||
desc_base64 = base64.b64encode( ndr_pack(desc) )
|
||||
desc_base64 = base64.b64encode( ndr_pack(desc) ).decode('utf8')
|
||||
self.ldb.add_ldif("""
|
||||
dn: """ + user_dn + """
|
||||
objectclass: user
|
||||
@ -3008,7 +3008,7 @@ sAMAccountName: """ + user_name)
|
||||
desc_sddl = desc.as_sddl(self.domain_sid)
|
||||
sddl = desc_sddl[:desc_sddl.find("(")] + "(A;;RPWP;;;AU)" + desc_sddl[desc_sddl.find("("):]
|
||||
desc = security.descriptor.from_sddl(sddl, self.domain_sid)
|
||||
desc_base64 = base64.b64encode(ndr_pack(desc))
|
||||
desc_base64 = base64.b64encode(ndr_pack(desc)).decode('utf8')
|
||||
mod = """
|
||||
dn: """ + user_dn + """
|
||||
changetype: modify
|
||||
@ -3036,7 +3036,7 @@ sAMAccountName: """ + user_name)
|
||||
# Modify descriptor
|
||||
sddl = "O:DUG:DUD:PAI(A;;RPWP;;;AU)S:PAI"
|
||||
desc = security.descriptor.from_sddl(sddl, self.domain_sid)
|
||||
desc_base64 = base64.b64encode(ndr_pack(desc))
|
||||
desc_base64 = base64.b64encode(ndr_pack(desc)).decode('utf8')
|
||||
mod = """
|
||||
dn: """ + user_dn + """
|
||||
changetype: modify
|
||||
|
@ -427,9 +427,9 @@ userPassword: thatsAcomplPASS2x
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2x\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2x\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e7:
|
||||
@ -468,9 +468,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2x\"".encode('utf-16-le'))
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2x\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2x\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
userpass = "thatsAcomplPASS2x"
|
||||
creds.set_password(userpass)
|
||||
@ -664,9 +664,9 @@ userPassword: thatsAcomplPASS2XYZ
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1x\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1x\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e10:
|
||||
@ -696,9 +696,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
|
||||
res = self._check_account(userdn,
|
||||
@ -717,9 +717,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e11:
|
||||
@ -761,9 +761,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e12:
|
||||
@ -791,9 +791,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e13:
|
||||
@ -818,9 +818,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e14:
|
||||
@ -845,9 +845,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e15:
|
||||
@ -891,9 +891,9 @@ unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(old_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
|
||||
res = self._check_account(userdn,
|
||||
@ -913,9 +913,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e16:
|
||||
@ -941,9 +941,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e17:
|
||||
@ -984,9 +984,9 @@ unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
dn: """ + userdn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(invalid_utf16).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16) + """
|
||||
unicodePwd:: """ + base64.b64encode(new_utf16).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e18:
|
||||
|
@ -201,9 +201,9 @@ unicodePwd: YYYYYYYYYYYYYYYY
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS1\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
|
||||
# Wrong old password
|
||||
@ -212,9 +212,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le'))
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS4\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS4\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e4:
|
||||
@ -228,9 +228,9 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS4\"".encode('utf-16-le'))
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS2\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e5:
|
||||
@ -354,9 +354,9 @@ userPassword: thatsAcomplPASS2
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS1".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS1".encode('utf-16-le')).decode('utf8') + """
|
||||
add: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
# this passes against s4
|
||||
except LdbError as e11:
|
||||
@ -371,9 +371,9 @@ clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le'
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS3".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS3".encode('utf-16-le')).decode('utf8') + """
|
||||
add: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS4".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS4".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e12:
|
||||
@ -389,9 +389,9 @@ clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS4".encode('utf-16-le'
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')).decode('utf8') + """
|
||||
add: clearTextPassword
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')) + """
|
||||
clearTextPassword:: """ + base64.b64encode("thatsAcomplPASS2".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
self.fail()
|
||||
except LdbError as e13:
|
||||
@ -647,7 +647,7 @@ changetype: modify
|
||||
delete: userPassword
|
||||
userPassword: thatsAcomplPASS2
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
# this passes against s4
|
||||
except LdbError as e30:
|
||||
@ -659,7 +659,7 @@ unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le'))
|
||||
dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).decode('utf8') + """
|
||||
add: userPassword
|
||||
userPassword: thatsAcomplPASS4
|
||||
""")
|
||||
@ -1118,7 +1118,7 @@ dn: cn=testuser,cn=users,""" + self.base_dn + """
|
||||
changetype: modify
|
||||
delete: unicodePwd
|
||||
add: unicodePwd
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')) + """
|
||||
unicodePwd:: """ + base64.b64encode("\"thatsAcomplPASS3\"".encode('utf-16-le')).decode('utf8') + """
|
||||
""")
|
||||
except LdbError, (num, msg):
|
||||
self.assertEquals(num, ERR_CONSTRAINT_VIOLATION)
|
||||
|
@ -31,7 +31,7 @@ from samba.dcerpc import security, samr
|
||||
import password_lockout_base
|
||||
|
||||
def passwd_encode(pw):
|
||||
return base64.b64encode(('"%s"' % pw).encode('utf-16-le'))
|
||||
return base64.b64encode(('"%s"' % pw).encode('utf-16-le')).decode('utf8')
|
||||
|
||||
|
||||
class RodcRwdcTestException(Exception):
|
||||
|
@ -96,7 +96,7 @@ systemOnly: FALSE
|
||||
if isinstance(desc, str):
|
||||
ldif += "nTSecurityDescriptor: %s" % desc
|
||||
elif isinstance(desc, security.descriptor):
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc))
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc)).decode('utf8')
|
||||
_ldb.add_ldif(ldif)
|
||||
return class_dn
|
||||
|
||||
@ -113,7 +113,7 @@ instanceType: 4
|
||||
if isinstance(desc, str):
|
||||
ldif += "nTSecurityDescriptor: %s" % desc
|
||||
elif isinstance(desc, security.descriptor):
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc))
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc)).decode('utf8')
|
||||
_ldb.add_ldif(ldif)
|
||||
|
||||
def create_configuration_specifier(self, _ldb, object_dn, desc=None):
|
||||
@ -127,7 +127,7 @@ showInAdvancedViewOnly: TRUE
|
||||
if isinstance(desc, str):
|
||||
ldif += "nTSecurityDescriptor: %s" % desc
|
||||
elif isinstance(desc, security.descriptor):
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc))
|
||||
ldif += "nTSecurityDescriptor:: %s" % base64.b64encode(ndr_pack(desc)).decode('utf8')
|
||||
_ldb.add_ldif(ldif)
|
||||
|
||||
def get_ldb_connection(self, target_username, target_password):
|
||||
|
@ -69,7 +69,7 @@ def encode_vlv_control(critical=1,
|
||||
if offset is not None:
|
||||
m = "%d:%d" % (offset, n)
|
||||
elif ':' in gte or '\x00' in gte:
|
||||
gte = base64.b64encode(gte)
|
||||
gte = base64.b64encode(gte).decode('utf8')
|
||||
m = "base64>=%s" % gte
|
||||
else:
|
||||
m = ">=%s" % gte
|
||||
|
Reference in New Issue
Block a user