Either the username or the filter are allowed. If both are given the filter is
going to be used due to a higher precedence.
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)
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)