summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-09-28 04:48:36 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-09-28 04:48:36 +0000
commitb2e39ddcf7f2a15024ea212c7047810e3523dbe8 (patch)
tree2c6757b3d6aa92450790ac99ef5ce78f4438911a /source3/passdb
parent75c50613316140314c89546c45d967bb0201c375 (diff)
downloadsamba-b2e39ddcf7f2a15024ea212c7047810e3523dbe8.tar.gz
samba-b2e39ddcf7f2a15024ea212c7047810e3523dbe8.tar.bz2
samba-b2e39ddcf7f2a15024ea212c7047810e3523dbe8.zip
How the heck I missed this I don't know, but somehow I got a copy-and-paste
error in here... Now you can change local passwords again. There is stil somthing broken about remote (via windows/sampasswd) password changing. I shall have to revise my testing, I honestly don't know how this slipped through the net. MERGE for 2.2.2. Sorry, Andrew Bartlett (This used to be commit 1f83184f881d0cabb698947660a12f729e625fae)
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/passdb.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index d29f140314..b3efebe5ff 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -847,7 +847,6 @@ BOOL local_password_change(char *user_name, int local_flags,
{
struct passwd *pwd = NULL;
SAM_ACCOUNT *sam_pass=NULL;
- SAM_ACCOUNT *new_sam_acct=NULL;
*err_str = '\0';
*msg_str = '\0';
@@ -876,34 +875,31 @@ account without a valid local system user.\n", user_name);
return False;
}
- /* create the SAM_ACCOUNT struct and call pdb_add_sam_account.
- Because the new_sam_pwd only exists in the scope of this function
- we will not allocate memory for members */
- if (!pdb_init_sam_pw(&new_sam_acct, pwd)) {
+ if (!pdb_init_sam_pw(&sam_pass, pwd)) {
return False;
}
/* set account flags */
- pdb_set_acct_ctrl(new_sam_acct,((local_flags & LOCAL_TRUST_ACCOUNT) ? ACB_WSTRUST : ACB_NORMAL) );
+ pdb_set_acct_ctrl(sam_pass,((local_flags & LOCAL_TRUST_ACCOUNT) ? ACB_WSTRUST : ACB_NORMAL) );
if (local_flags & LOCAL_DISABLE_USER)
- pdb_set_acct_ctrl (new_sam_acct, pdb_get_acct_ctrl(new_sam_acct)|ACB_DISABLED);
+ pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)|ACB_DISABLED);
- if (local_flags & LOCAL_SET_NO_PASSWORD)
- pdb_set_acct_ctrl (new_sam_acct, pdb_get_acct_ctrl(new_sam_acct)|ACB_PWNOTREQ);
- else {
+ if (local_flags & LOCAL_SET_NO_PASSWORD) {
+ pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)|ACB_PWNOTREQ);
+ } else {
/* set the passwords here. if we get to here it means
we have a valid, active account */
- pdb_set_plaintext_passwd (new_sam_acct, new_passwd);
+ pdb_set_plaintext_passwd (sam_pass, new_passwd);
}
- if (pdb_add_sam_account(new_sam_acct)) {
+ if (pdb_add_sam_account(sam_pass)) {
slprintf(msg_str, msg_str_len-1, "Added user %s.\n", user_name);
- pdb_free_sam(new_sam_acct);
+ pdb_free_sam(sam_pass);
return True;
} else {
slprintf(err_str, err_str_len-1, "Failed to add entry for user %s.\n", user_name);
- pdb_free_sam(new_sam_acct);
+ pdb_free_sam(sam_pass);
return False;
}
} else {
@@ -920,7 +916,7 @@ account without a valid local system user.\n", user_name);
pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)|ACB_DISABLED);
} else if (local_flags & LOCAL_ENABLE_USER) {
if(pdb_get_lanman_passwd(sam_pass) == NULL) {
- pdb_set_plaintext_passwd (new_sam_acct, new_passwd);
+ pdb_set_plaintext_passwd (sam_pass, new_passwd);
}
pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_DISABLED));
} else if (local_flags & LOCAL_SET_NO_PASSWORD) {
@@ -942,7 +938,7 @@ account without a valid local system user.\n", user_name);
if ((pdb_get_lanman_passwd(sam_pass)==NULL) && (pdb_get_acct_ctrl(sam_pass)&ACB_DISABLED))
pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_DISABLED));
pdb_set_acct_ctrl (sam_pass, pdb_get_acct_ctrl(sam_pass)&(~ACB_PWNOTREQ));
- pdb_set_plaintext_passwd (new_sam_acct, new_passwd);
+ pdb_set_plaintext_passwd (sam_pass, new_passwd);
}
if(local_flags & LOCAL_DELETE_USER) {