1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

s4: Correct the parameter logic of the "setpassword" script

Either the username or the filter are allowed. If both are given the filter is
going to be used due to a higher precedence.
This commit is contained in:
Matthias Dieter Wallnöfer 2009-08-13 23:04:34 +02:00
parent 44dfb2902e
commit 639c9ccb93

View File

@ -52,7 +52,10 @@ def message(text):
if not opts.quiet:
print text
if len(args) == 0:
filter = opts.filter
if (len(args) == 0) and (filter is None):
print "Either the username or '--filter' must be specified!"
parser.print_usage()
sys.exit(1)
@ -60,16 +63,10 @@ password = opts.newpassword;
if password is None:
password = getpass("New Password: ")
filter = opts.filter
if filter is None:
username = args[0]
if username is None:
print "Either username or --filter must be specified"
filter = "(&(objectclass=user)(samAccountName=%s))" % (username)
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)