summaryrefslogtreecommitdiff
path: root/source4/auth/auth_sam.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-26 06:44:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:17 -0500
commit3ea916b2278c202c99c80c02e80e588bd7daedb8 (patch)
tree95cb6b71a66de1101c568b77b32bd636b2a51b1f /source4/auth/auth_sam.c
parentdbc2346de8b2f213d8bb7e647c4f187c6103e474 (diff)
downloadsamba-3ea916b2278c202c99c80c02e80e588bd7daedb8.tar.gz
samba-3ea916b2278c202c99c80c02e80e588bd7daedb8.tar.bz2
samba-3ea916b2278c202c99c80c02e80e588bd7daedb8.zip
r2654: fixed some more server memory leaks. We are now down to a single leak
of 16 bytes, caused by the 16 byte data_blob in the smb_signing code. (This used to be commit 2f1b788e09686e065d22f621f5c0c585192c6740)
Diffstat (limited to 'source4/auth/auth_sam.c')
-rw-r--r--source4/auth/auth_sam.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c
index 8c86328c05..6ddddafee3 100644
--- a/source4/auth/auth_sam.c
+++ b/source4/auth/auth_sam.c
@@ -39,6 +39,8 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
DATA_BLOB *user_sess_key,
DATA_BLOB *lm_sess_key)
{
+ NTSTATUS status;
+
if (acct_flags & ACB_PWNOTREQ) {
if (lp_null_passwords()) {
DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n",
@@ -51,7 +53,7 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
}
}
- return ntlm_password_check(mem_ctx, &auth_context->challenge,
+ status = ntlm_password_check(mem_ctx, &auth_context->challenge,
&user_info->lm_resp, &user_info->nt_resp,
&user_info->lm_interactive_password,
&user_info->nt_interactive_password,
@@ -59,6 +61,17 @@ static NTSTATUS sam_password_ok(const struct auth_context *auth_context,
user_info->smb_name.str,
user_info->client_domain.str,
lm_pwd->hash, nt_pwd->hash, user_sess_key, lm_sess_key);
+
+ if (NT_STATUS_IS_OK(status)) {
+ if (user_sess_key && user_sess_key->data) {
+ talloc_steal(auth_context, user_sess_key->data);
+ }
+ if (lm_sess_key && lm_sess_key->data) {
+ talloc_steal(auth_context, lm_sess_key->data);
+ }
+ }
+
+ return status;
}
@@ -330,8 +343,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
}
if (group_ret > 0 &&
- !(groupSIDs = talloc_realloc_p(groupSIDs,
- struct dom_sid *, group_ret))) {
+ !(groupSIDs = talloc_array_p(*server_info, struct dom_sid *, group_ret))) {
talloc_free(*server_info);
return NT_STATUS_NO_MEMORY;
}