diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-18 20:22:03 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-18 20:27:30 +0200 |
commit | 1f38aa0995f7ffa82f670fe5d36046dd6b8f44ac (patch) | |
tree | 0aa9f9120bd718a9238a311e43bf7dbeaf3953ce /source4/setup/newuser | |
parent | bc2a05f0010f5dece89fda13fd525a1a7ca536a0 (diff) | |
download | samba-1f38aa0995f7ffa82f670fe5d36046dd6b8f44ac.tar.gz samba-1f38aa0995f7ffa82f670fe5d36046dd6b8f44ac.tar.bz2 samba-1f38aa0995f7ffa82f670fe5d36046dd6b8f44ac.zip |
s4:various scripts under "setup" - Unification
- This unified the shape of those four scripts (comments, command sequence, call
of SamDB)
- To consider the samdb.py changes regarding the filter: there is now always the
possibility either to specify the username or the search filter
Diffstat (limited to 'source4/setup/newuser')
-rwxr-xr-x | source4/setup/newuser | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/setup/newuser b/source4/setup/newuser index cc89e922a7..422677c301 100755 --- a/source4/setup/newuser +++ b/source4/setup/newuser @@ -1,6 +1,6 @@ #!/usr/bin/python # -# Add a new user to a Samba4 server +# Adds a new user to a Samba4 server # Copyright Jelmer Vernooij 2008 # # Based on the original in EJS: @@ -18,6 +18,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. + import sys # Find right directory when running from source tree @@ -25,8 +26,10 @@ sys.path.insert(0, "bin/python") import samba.getopt as options import optparse + from getpass import getpass from samba.auth import system_session +from samba.samdb import SamDB parser = optparse.OptionParser("newuser [options] <username> [<password>]") sambaopts = options.SambaOptions(parser) @@ -34,7 +37,6 @@ parser.add_option_group(sambaopts) parser.add_option_group(options.VersionOptions(parser)) credopts = options.CredentialsOptions(parser) parser.add_option_group(credopts) -parser.add_option("--quiet", help="Be quiet", action="store_true") parser.add_option("--unixname", help="Unix Username", type=str) parser.add_option("--must-change-at-next-login", help="Force password to be changed on next login", action="store_true") @@ -56,6 +58,6 @@ if opts.unixname is None: lp = sambaopts.get_loadparm() creds = credopts.get_credentials(lp) -samdb = sambaopts.get_hostconfig().get_samdb(session_info=system_session(), - credentials=creds) +samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), + credentials=creds, lp=lp) samdb.newuser(username, opts.unixname, password, force_password_change_at_next_login=opts.must_change_at_next_login) |