*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
+ * Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
printf(" -i interdomain trust account\n");
printf(" -m machine trust account\n");
printf(" -n set no password\n");
+ printf(" -W use stdin ldap admin password\n");
printf(" -w PASSWORD ldap admin password\n");
printf(" -x delete user\n");
printf(" -R ORDER name resolve order\n");
if (!lp_load(configfile,True,False,False,True)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- dyn_CONFIGFILE);
+ configfile);
exit(1);
}
}
/* Ensure passdb startup(). */
- if(!initialize_password_db(False)) {
+ if(!initialize_password_db(False, NULL)) {
DEBUG(0, ("Failed to open passdb!\n"));
exit(1);
}
if(local_flags & LOCAL_ENABLE_USER) {
struct samu *sampass = NULL;
- BOOL ret;
sampass = samu_new( NULL );
- ret = pdb_getsampwnam(sampass, user_name);
- if((ret) &&
- (pdb_get_lanman_passwd(sampass) == NULL)) {
+ if (!sampass) {
+ fprintf(stderr, "talloc fail for struct samu.\n");
+ exit(1);
+ }
+ if (!pdb_getsampwnam(sampass, user_name)) {
+ fprintf(stderr, "Failed to find user %s in passdb backend.\n",
+ user_name );
+ exit(1);
+ }
+
+ if(pdb_get_nt_passwd(sampass) == NULL) {
local_flags |= LOCAL_SET_PASSWORD;
}
TALLOC_FREE(sampass);
printf("Password changed for user %s on %s.\n", user_name, remote_machine );
} else if(!(local_flags & (LOCAL_ADD_USER|LOCAL_DISABLE_USER|LOCAL_ENABLE_USER|LOCAL_DELETE_USER|LOCAL_SET_NO_PASSWORD|LOCAL_SET_PASSWORD))) {
struct samu *sampass = NULL;
- BOOL ret;
sampass = samu_new( NULL );
- ret = pdb_getsampwnam(sampass, user_name);
+ if (!sampass) {
+ fprintf(stderr, "talloc fail for struct samu.\n");
+ exit(1);
+ }
+
+ if (!pdb_getsampwnam(sampass, user_name)) {
+ fprintf(stderr, "Failed to find user %s in passdb backend.\n",
+ user_name );
+ exit(1);
+ }
printf("Password changed for user %s.", user_name );
- if( (ret != False) && (pdb_get_acct_ctrl(sampass)&ACB_DISABLED) )
+ if(pdb_get_acct_ctrl(sampass)&ACB_DISABLED) {
printf(" User has disabled flag set.");
- if((ret != False) && (pdb_get_acct_ctrl(sampass) & ACB_PWNOTREQ) )
+ }
+ if(pdb_get_acct_ctrl(sampass) & ACB_PWNOTREQ) {
printf(" User has no password flag set.");
+ }
printf("\n");
TALLOC_FREE(sampass);
}