From 3ea916b2278c202c99c80c02e80e588bd7daedb8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 26 Sep 2004 06:44:08 +0000 Subject: 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) --- source4/auth/auth_sam.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source4/auth') 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; } -- cgit