From: Matthias Dieter Wallnöfer Date: Fri, 7 May 2010 22:48:33 +0000 (+0200) Subject: s4:net utility - add an optional password attribute to "net user add" X-Git-Tag: samba-3.6.0pre1~2159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=544dc4465c5ade3c5ed8417ddd5f09d4af0c2b31;p=thirdparty%2Fsamba.git s4:net utility - add an optional password attribute to "net user add" To make it behave similar to "net newuser". --- diff --git a/source4/scripting/python/samba/netcmd/user.py b/source4/scripting/python/samba/netcmd/user.py index 7597f462b65..54ddfe23228 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 " + synopsis = "%prog user add []" 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):