[PATCH 3/3] s3-auth: Pass mem_ctx to do_map_to_guest_server_info().

Andreas Schneider asn at samba.org
Tue Feb 18 06:50:59 MST 2014


Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/auth/auth_ntlmssp.c |  7 ++++---
 source3/auth/auth_util.c    | 12 +++++++-----
 source3/auth/proto.h        |  8 +++++---
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/source3/auth/auth_ntlmssp.c b/source3/auth/auth_ntlmssp.c
index cb7726c..d4fe901 100644
--- a/source3/auth/auth_ntlmssp.c
+++ b/source3/auth/auth_ntlmssp.c
@@ -151,10 +151,11 @@ NTSTATUS auth3_check_password(struct auth4_context *auth4_context,
 	free_user_info(&mapped_user_info);
 
 	if (!NT_STATUS_IS_OK(nt_status)) {
-		nt_status = do_map_to_guest_server_info(nt_status,
-							&server_info,
+		nt_status = do_map_to_guest_server_info(mem_ctx,
+							nt_status,
 							user_info->client.account_name,
-							user_info->client.domain_name);
+							user_info->client.domain_name,
+							&server_info);
 		*server_returned_info = talloc_steal(mem_ctx, server_info);
 		return nt_status;
 	}
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 2b6b13f..fb9e8c8 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1536,9 +1536,11 @@ bool is_trusted_domain(const char* dom_name)
   on a logon error possibly map the error to success if "map to guest"
   is set approriately
 */
-NTSTATUS do_map_to_guest_server_info(NTSTATUS status,
-				     struct auth_serversupplied_info **server_info,
-				     const char *user, const char *domain)
+NTSTATUS do_map_to_guest_server_info(TALLOC_CTX *mem_ctx,
+				     NTSTATUS status,
+				     const char *user,
+				     const char *domain,
+				     struct auth_serversupplied_info **server_info)
 {
 	user = user ? user : "";
 	domain = domain ? domain : "";
@@ -1548,13 +1550,13 @@ NTSTATUS do_map_to_guest_server_info(NTSTATUS status,
 		    (lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_PASSWORD)) {
 			DEBUG(3,("No such user %s [%s] - using guest account\n",
 				 user, domain));
-			return make_server_info_guest(NULL, server_info);
+			return make_server_info_guest(mem_ctx, server_info);
 		}
 	} else if (NT_STATUS_EQUAL(status, NT_STATUS_WRONG_PASSWORD)) {
 		if (lp_map_to_guest() == MAP_TO_GUEST_ON_BAD_PASSWORD) {
 			DEBUG(3,("Registered username %s for guest access\n",
 				user));
-			return make_server_info_guest(NULL, server_info);
+			return make_server_info_guest(mem_ctx, server_info);
 		}
 	}
 
diff --git a/source3/auth/proto.h b/source3/auth/proto.h
index 15b1ba0..7b8959f 100644
--- a/source3/auth/proto.h
+++ b/source3/auth/proto.h
@@ -264,9 +264,11 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
 			enum auth_password_state password_state);
 void free_user_info(struct auth_usersupplied_info **user_info);
 
-NTSTATUS do_map_to_guest_server_info(NTSTATUS status,
-				     struct auth_serversupplied_info **server_info,
-				     const char *user, const char *domain);
+NTSTATUS do_map_to_guest_server_info(TALLOC_CTX *mem_ctx,
+				     NTSTATUS status,
+				     const char *user,
+				     const char *domain,
+				     struct auth_serversupplied_info **server_info);
 
 /* The following definitions come from auth/auth_winbind.c  */
 
-- 
1.8.5.2




More information about the samba-technical mailing list