summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-08 00:48:33 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-05-09 19:14:46 +0200
commit544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31 (patch)
treef1a27a1109ee7bc7333d88ecd29430cdb73a615c /source4/scripting
parent6dfa851ce95b372c6c4bdd7a6c07c1ee183d1f7a (diff)
downloadsamba-544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31.tar.gz
samba-544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31.tar.bz2
samba-544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31.zip
s4:net utility - add an optional password attribute to "net user add"
To make it behave similar to "net newuser".
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/netcmd/user.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py
index 7597f462b6..54ddfe2322 100644
--- a/source4/scripting/python/samba/netcmd/user.py
+++ b/source4/scripting/python/samba/netcmd/user.py
@@ -29,7 +29,7 @@ from samba.netcmd import (
class cmd_user_add(Command):
"""Create a new user."""
- synopsis = "%prog user add <name>"
+ synopsis = "%prog user add <name> [<password>]"
takes_optiongroups = {
"sambaopts": options.SambaOptions,
@@ -37,13 +37,15 @@ class cmd_user_add(Command):
"versionopts": options.VersionOptions,
}
- takes_args = ["name"]
+ takes_args = ["name", "password?"]
- def run(self, name, credopts=None, sambaopts=None, versionopts=None):
+ def run(self, name, password=None, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
net = Net(creds, lp)
net.create_user(name)
+ if password is not None:
+ net.set_password(name, creds.get_domain(), password, creds)
class cmd_user_delete(Command):