Fix newuser and setpassword scripts, and port to idmap.
[samba.git] / source4 / setup / setpassword
index 31b2f73a256b6078cf3c2efb5de7476f43c1d7c8..977a6a5ee89011c0f540378d3193812ddcbe0188 100644 (file)
@@ -36,7 +36,7 @@ if len(args) == 0:
        parser.print_usage()
        sys.exit(1)
 
-password = opts.password;
+password = opts.newpassword;
 if password is None:
        password = getpass("New Password: ")
 
@@ -47,12 +47,12 @@ if filter is None:
        if username is None:
                print "Either username or --filter must be specified"
 
-       filter = "(&(objectclass=user)(samAccountName=" + username + "))"
+       filter = "(&(objectclass=user)(samAccountName=%s))" % (username)
 
 
-creds = credopts.get_credentials()
-
 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)