summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-06 12:36:56 +0100
committerMichael Adam <obnox@samba.org>2010-01-07 11:07:56 +0100
commit970317c413eae52af9976e5652362412dd3038e3 (patch)
treee882f120efc73833861ce833684e46a2a22c6aac /source3
parentde4fb80beec59999dd9ce074d4fff0b310fb08da (diff)
downloadsamba-970317c413eae52af9976e5652362412dd3038e3.tar.gz
samba-970317c413eae52af9976e5652362412dd3038e3.tar.bz2
samba-970317c413eae52af9976e5652362412dd3038e3.zip
s3:auth:check_sam_security: create (and use) a common exit point
for use after sam_password_ok() has been called. Michael
Diffstat (limited to 'source3')
-rw-r--r--source3/auth/auth_sam.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/source3/auth/auth_sam.c b/source3/auth/auth_sam.c
index 3573de1375..dd4a465e7d 100644
--- a/source3/auth/auth_sam.c
+++ b/source3/auth/auth_sam.c
@@ -370,10 +370,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
DEBUG(1, ("Failed to modify entry.\n"));
unbecome_root();
}
- data_blob_free(&user_sess_key);
- data_blob_free(&lm_sess_key);
- TALLOC_FREE(sampass);
- return nt_status;
+ goto done;
}
if ((acct_ctrl & ACB_NORMAL) &&
@@ -393,10 +390,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
nt_status = sam_account_ok(mem_ctx, sampass, user_info);
if (!NT_STATUS_IS_OK(nt_status)) {
- TALLOC_FREE(sampass);
- data_blob_free(&user_sess_key);
- data_blob_free(&lm_sess_key);
- return nt_status;
+ goto done;
}
become_root();
@@ -406,9 +400,7 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0,("check_sam_security: make_server_info_sam() failed with '%s'\n", nt_errstr(nt_status)));
- data_blob_free(&user_sess_key);
- data_blob_free(&lm_sess_key);
- return nt_status;
+ goto done;
}
(*server_info)->user_session_key =
@@ -423,6 +415,10 @@ static NTSTATUS check_sam_security(const struct auth_context *auth_context,
(*server_info)->nss_token |= user_info->was_mapped;
+done:
+ TALLOC_FREE(sampass);
+ data_blob_free(&user_sess_key);
+ data_blob_free(&lm_sess_key);
return nt_status;
}