summaryrefslogtreecommitdiff
path: root/source4/setup/setpassword
diff options
context:
space:
mode:
Diffstat (limited to 'source4/setup/setpassword')
-rwxr-xr-xsource4/setup/setpassword12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/setup/setpassword b/source4/setup/setpassword
index d8a2a1144a..57772be7a7 100755
--- a/source4/setup/setpassword
+++ b/source4/setup/setpassword
@@ -38,6 +38,7 @@ parser.add_option_group(sambaopts)
parser.add_option_group(options.VersionOptions(parser))
credopts = options.CredentialsOptions(parser)
parser.add_option_group(credopts)
+parser.add_option("-H", help="LDB URL for database or target server", type=str)
parser.add_option("--filter", help="LDAP Filter to set password on", type=str)
parser.add_option("--newpassword", help="Set password", type=str)
parser.add_option("--must-change-at-next-login", help="Force password to be changed on next login", action="store_true")
@@ -62,7 +63,12 @@ if filter is None:
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, force_password_change_at_next_login=opts.must_change_at_next_login)
+if opts.H is not None:
+ url = opts.H
+else:
+ url = lp.get("sam database")
+
+samdb = SamDB(url=url, session_info=system_session(), credentials=creds, lp=lp)
+
+samdb.setpassword(filter, password, force_password_change_at_next_login_req=opts.must_change_at_next_login)