summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-04-14 20:00:32 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-04-14 20:00:32 +0200
commit18f8f5d6561d50b9179541ea24e03a5a807a2a2a (patch)
tree4759b1bc65e703213178d7ab4ef7c1a80e713161 /source4/setup
parenta15b6f1606e1c761c2c4037b734137e97f00489f (diff)
parent68a2c547d00d7a8d0c15744172489d9d010c31a3 (diff)
downloadsamba-18f8f5d6561d50b9179541ea24e03a5a807a2a2a.tar.gz
samba-18f8f5d6561d50b9179541ea24e03a5a807a2a2a.tar.bz2
samba-18f8f5d6561d50b9179541ea24e03a5a807a2a2a.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake4
(This used to be commit 1ef3830bb0d6e91e3b00e880784ca0741d9b4d49)
Diffstat (limited to 'source4/setup')
-rwxr-xr-xsource4/setup/newuser10
-rw-r--r--source4/setup/setpassword8
-rwxr-xr-xsource4/setup/tests/blackbox_provision.sh7
3 files changed, 11 insertions, 14 deletions
diff --git a/source4/setup/newuser b/source4/setup/newuser
index f622058a5d..04a5440ee1 100755
--- a/source4/setup/newuser
+++ b/source4/setup/newuser
@@ -45,15 +45,9 @@ else:
if opts.unixname is None:
opts.unixname = username
-try:
- pwd.getpwnam(opts.unixname)
-except KeyError:
- print "ERROR: Unix user '%s' does not exist" % opts.unixname
- sys.exit(1)
-
-creds = credopts.get_credentials()
-
lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
credentials=creds, lp=lp)
samdb.newuser(username, opts.unixname, password)
diff --git a/source4/setup/setpassword b/source4/setup/setpassword
index 31b2f73a25..977a6a5ee8 100644
--- a/source4/setup/setpassword
+++ b/source4/setup/setpassword
@@ -36,7 +36,7 @@ if len(args) == 0:
parser.print_usage()
sys.exit(1)
-password = opts.password;
+password = opts.newpassword;
if password is None:
password = getpass("New Password: ")
@@ -47,12 +47,12 @@ if filter is None:
if username is None:
print "Either username or --filter must be specified"
- filter = "(&(objectclass=user)(samAccountName=" + username + "))"
+ filter = "(&(objectclass=user)(samAccountName=%s))" % (username)
-creds = credopts.get_credentials()
-
lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
samdb = SamDB(url=lp.get("sam database"), session_info=system_session(),
credentials=creds, lp=lp)
samdb.setpassword(filter, password)
diff --git a/source4/setup/tests/blackbox_provision.sh b/source4/setup/tests/blackbox_provision.sh
index 4db226778c..19f37cef2d 100755
--- a/source4/setup/tests/blackbox_provision.sh
+++ b/source4/setup/tests/blackbox_provision.sh
@@ -31,8 +31,11 @@ testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --
testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member
testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone
-testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --blank
-testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --partitions-only
+testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/blank-dc --blank
+testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/partitions-only-dc --partitions-only
+
+testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
+testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass
reprovision() {
$PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"