From cdbc00bb52f39472fe5f1380b15180205644c8e9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 2 Mar 2009 05:07:30 +0100 Subject: Fix test_surrounding in samba4.rpcecho.python. --- source4/scripting/python/samba/tests/dcerpc/rpcecho.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py index 12638e2397..62268005c2 100644 --- a/source4/scripting/python/samba/tests/dcerpc/rpcecho.py +++ b/source4/scripting/python/samba/tests/dcerpc/rpcecho.py @@ -49,7 +49,7 @@ class RpcEchoTests(RpcInterfaceTestCase): surrounding_struct.x = 4 surrounding_struct.surrounding = [1,2,3,4] y = self.conn.TestSurrounding(surrounding_struct) - self.assertEquals(8 * [0], y.surrounding) + self.assertEquals(4 * [0], y.surrounding) def test_manual_request(self): self.assertEquals("\x01\x00\x00\x00", self.conn.request(0, chr(0) * 4)) -- cgit From 952bdffaadebe8fc147c69da160ddd83e1d03245 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 Mar 2009 14:02:35 +1100 Subject: Don't print the admin password if we don't set one. For example, if we don't create the admin user (perhaps expecting users to be in LDAP already, or we are due an incoming replication) we should not confuse the administrator by printing a unused password. Andrew Bartlett --- source4/scripting/python/samba/provision.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 0aa84ec6db..d96857661e 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -1136,7 +1136,8 @@ def provision(setup_dir, message, session_info, message("NetBIOS Domain: %s" % names.domain) message("DNS Domain: %s" % names.dnsdomain) message("DOMAIN SID: %s" % str(domainsid)) - message("Admin password: %s" % adminpass) + if samdb_fill == FILL_FULL: + message("Admin password: %s" % adminpass) result = ProvisionResult() result.domaindn = domaindn -- cgit From 917905aea0cfeff53009839f70cdc9eefdcfa2c9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 12 Mar 2009 13:13:14 +1100 Subject: removed leading spaces from embedded ldif This fixes the problem with the setpassword command failing like this: Error: First line of ldif must be a dn not ' dn' --- source4/scripting/python/samba/samdb.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 614970d3ec..740806f266 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -175,10 +175,10 @@ userAccountControl: %u user_dn = res[0].dn setpw = """ - dn: %s - changetype: modify - replace: userPassword - userPassword: %s +dn: %s +changetype: modify +replace: userPassword +userPassword: %s """ % (user_dn, password) self.modify_ldif(setpw) @@ -229,12 +229,12 @@ userAccountControl: %u accountExpires = glue.unix2nttime(expiry_seconds + int(time.time())) mod = """ - dn: %s - changetype: modify - replace: userAccountControl - userAccountControl: %u - replace: accountExpires - accountExpires: %u +dn: %s +changetype: modify +replace: userAccountControl +userAccountControl: %u +replace: accountExpires +accountExpires: %u """ % (res[0].dn, userAccountControl, accountExpires) # now change the database self.modify_ldif(mod) -- cgit From 0770028cbea5f13c0dda2b9a89803359bed66306 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 12 Mar 2009 15:13:23 +1100 Subject: fixed more embedded spaces in LDIF This one added 3 spaces to the end of any new passwords --- source4/scripting/python/samba/samdb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 740806f266..1c5a8dfcde 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -59,7 +59,7 @@ dn: CN=%s,CN=ForeignSecurityPrincipals,%s objectClass: top objectClass: foreignSecurityPrincipal description: %s - """ % (sid, domaindn, desc) +""" % (sid, domaindn, desc) # deliberately ignore errors from this, as the records may # already exist for msg in self.parse_ldif(add): @@ -179,7 +179,7 @@ dn: %s changetype: modify replace: userPassword userPassword: %s - """ % (user_dn, password) +""" % (user_dn, password) self.modify_ldif(setpw) @@ -235,7 +235,7 @@ replace: userAccountControl userAccountControl: %u replace: accountExpires accountExpires: %u - """ % (res[0].dn, userAccountControl, accountExpires) +""" % (res[0].dn, userAccountControl, accountExpires) # now change the database self.modify_ldif(mod) except: -- cgit From 483525f73c5597c0c35de4288d97f53b9d3d262e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 12 Mar 2009 15:20:25 +1100 Subject: use a base64 encoded password when changing passwords This avoids problems with embedded control characters in password changes --- source4/scripting/python/samba/samdb.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 1c5a8dfcde..b92a91e2ef 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -28,6 +28,7 @@ import ldb from samba.idmap import IDmapDB import pwd import time +import base64 __docformat__ = "restructuredText" @@ -178,8 +179,8 @@ userAccountControl: %u dn: %s changetype: modify replace: userPassword -userPassword: %s -""" % (user_dn, password) +userPassword:: %s +""" % (user_dn, base64.b64encode(password)) self.modify_ldif(setpw) -- cgit