summaryrefslogtreecommitdiff
path: root/source4/setup/setexpiry
diff options
context:
space:
mode:
Diffstat (limited to 'source4/setup/setexpiry')
-rwxr-xr-xsource4/setup/setexpiry12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/setup/setexpiry b/source4/setup/setexpiry
index 1572555b8c..2740326f2b 100755
--- a/source4/setup/setexpiry
+++ b/source4/setup/setexpiry
@@ -37,12 +37,15 @@ 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("--days", help="Days to expiry", type=int)
parser.add_option("--noexpiry", help="Password does never expire", action="store_true")
opts, args = parser.parse_args()
+filter = opts.filter
+
if (len(args) == 0) and (filter is None):
print "Either the username or '--filter' must be specified!"
parser.print_usage()
@@ -59,6 +62,11 @@ 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)
+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.setexpiry(filter, days*24*3600, no_expiry_req=opts.noexpiry)