summaryrefslogtreecommitdiff
path: root/source3/auth/auth.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2017-02-11 11:34:58 +0100
committerJeremy Allison <jra@samba.org>2017-03-08 22:01:15 +0100
commit56b0303a611d1fdcee4f37285164fe94866fda59 (patch)
tree635c23353c1f2fbc3ff7301c9a8d0ce54c67e7cf /source3/auth/auth.c
parentb19868ce6ab823e447a6195d29291b9205422e67 (diff)
downloadsamba-56b0303a611d1fdcee4f37285164fe94866fda59.tar.gz
auth3: Simplify auth_check_ntlm_password server_info handling
Instead of directly assigning (*pserver_info), work on a local copy first and assign it once when successful Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/auth/auth.c')
-rw-r--r--source3/auth/auth.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 2f84c70b56e..437cca74103 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -170,6 +170,7 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
NTSTATUS nt_status = NT_STATUS_NO_SUCH_USER;
const char *unix_username;
auth_methods *auth_method;
+ struct auth_serversupplied_info *server_info;
if (user_info == NULL || auth_context == NULL || pserver_info == NULL) {
return NT_STATUS_LOGON_FAILURE;
@@ -213,7 +214,6 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
}
for (auth_method = auth_context->auth_method_list;auth_method; auth_method = auth_method->next) {
- struct auth_serversupplied_info *server_info;
NTSTATUS result;
if (user_info->flags & USER_INFO_LOCAL_SAM_ONLY
@@ -251,7 +251,6 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
}
if (NT_STATUS_IS_OK(nt_status)) {
- *pserver_info = talloc_move(mem_ctx, &server_info);
break;
}
}
@@ -259,11 +258,11 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
/* successful authentication */
if (NT_STATUS_IS_OK(nt_status)) {
- unix_username = (*pserver_info)->unix_name;
+ unix_username = server_info->unix_name;
/* We skip doing this step if the caller asked us not to */
if (!(user_info->flags & USER_INFO_INFO3_AND_NO_AUTHZ)
- && !(*pserver_info)->guest) {
+ && !(server_info->guest)) {
const char *rhost;
if (tsocket_address_is_inet(user_info->remote_host, "ip")) {
@@ -293,12 +292,14 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx,
}
if (NT_STATUS_IS_OK(nt_status)) {
- DEBUG((*pserver_info)->guest ? 5 : 2,
+ DEBUG(server_info->guest ? 5 : 2,
("check_ntlm_password: %sauthentication for user [%s] -> [%s] -> [%s] succeeded\n",
- (*pserver_info)->guest ? "guest " : "",
+ server_info->guest ? "guest " : "",
user_info->client.account_name,
user_info->mapped.account_name,
unix_username));
+
+ *pserver_info = talloc_move(mem_ctx, &server_info);
}
TALLOC_FREE(frame);