summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-01-08 07:02:18 +0000
committerJeremy Allison <jra@samba.org>2003-01-08 07:02:18 +0000
commit8df73edd8e819f13044c9deb2b7c90f0d9ef4a36 (patch)
tree3c8f371305cf39d1b85e9828c08fe9d8398a806a /source3/smbd
parent6e87ae0db382b9a78de17e7503f68401c5a789a9 (diff)
downloadsamba-8df73edd8e819f13044c9deb2b7c90f0d9ef4a36.tar.gz
samba-8df73edd8e819f13044c9deb2b7c90f0d9ef4a36.tar.bz2
samba-8df73edd8e819f13044c9deb2b7c90f0d9ef4a36.zip
Fix erroneous free of SAM_ACCOUNT (make clearer when allocated
memory is being returned). Jeremy (This used to be commit b0d547b7396beff861bb116051ed06b7b9749005)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/chgpasswd.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index aad62d8a98..cc130d16c2 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -800,6 +800,8 @@ static NTSTATUS check_oem_password(const char *user,
BOOL nt_pass_set = (ntdata != NULL && nthash != NULL);
+ *hnd = NULL;
+
pdb_init_sam(&sampass);
become_root();
@@ -816,8 +818,6 @@ static NTSTATUS check_oem_password(const char *user,
*/
}
- *hnd = sampass;
-
acct_ctrl = pdb_get_acct_ctrl(sampass);
if (acct_ctrl & ACB_DISABLED) {
@@ -888,16 +888,14 @@ static NTSTATUS check_oem_password(const char *user,
nt_lm_owf_gen(new_passwd, new_ntp16, new_p16);
- if (!nt_pass_set)
- {
+ if (!nt_pass_set) {
/*
* Now use new_p16 as the key to see if the old
* password matches.
*/
D_P16(new_p16, lmhash, unenc_old_pw);
- if (memcmp(lanman_pw, unenc_old_pw, 16))
- {
+ if (memcmp(lanman_pw, unenc_old_pw, 16)) {
DEBUG(0,("check_oem_password: old lm password doesn't match.\n"));
pdb_free_sam(&sampass);
return NT_STATUS_WRONG_PASSWORD;
@@ -907,7 +905,7 @@ static NTSTATUS check_oem_password(const char *user,
DEBUG(100,
("check_oem_password: password %s ok\n", new_passwd));
#endif
- pdb_free_sam(&sampass);
+ *hnd = sampass;
return NT_STATUS_OK;
}
@@ -918,15 +916,13 @@ static NTSTATUS check_oem_password(const char *user,
D_P16(new_ntp16, lmhash, unenc_old_pw);
D_P16(new_ntp16, nthash, unenc_old_ntpw);
- if (memcmp(lanman_pw, unenc_old_pw, 16))
- {
+ if (memcmp(lanman_pw, unenc_old_pw, 16)) {
DEBUG(0,("check_oem_password: old lm password doesn't match.\n"));
pdb_free_sam(&sampass);
return NT_STATUS_WRONG_PASSWORD;
}
- if (memcmp(nt_pw, unenc_old_ntpw, 16))
- {
+ if (memcmp(nt_pw, unenc_old_ntpw, 16)) {
DEBUG(0,("check_oem_password: old nt password doesn't match.\n"));
pdb_free_sam(&sampass);
return NT_STATUS_WRONG_PASSWORD;
@@ -935,7 +931,7 @@ static NTSTATUS check_oem_password(const char *user,
DEBUG(100, ("check_oem_password: password %s ok\n", new_passwd));
#endif
- pdb_free_sam(&sampass);
+ *hnd = sampass;
return NT_STATUS_OK;
}
@@ -1008,6 +1004,3 @@ NTSTATUS change_oem_password(SAM_ACCOUNT *hnd, char *old_passwd, char *new_passw
return NT_STATUS_OK;
}
-
-
-