[SCM] Samba Shared Repository - branch master updated

Simo Sorce idra at samba.org
Sat May 29 07:24:28 MDT 2010


The branch, master has been updated
       via  b455c5e... s3:auth Fix segfault when the user cannot be found by getpwnam()
      from  a8d308f... s3-selftest: fix chmod commands in provisioning.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b455c5e155f7e7ba4cc07cd4415a304163213e0f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat May 29 04:14:27 2010 +1000

    s3:auth Fix segfault when the user cannot be found by getpwnam()
    
    Add comment to notify when getpwnam() fails.
    
    Reviewed-by: Simo Sorce <idra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/auth/auth_util.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index bccec80..1f9bc7b 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -964,7 +964,6 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain,
 			      bool *username_was_mapped)
 {
 	struct smbd_server_connection *sconn = smbd_server_conn;
-	NTSTATUS nt_status;
 	fstring dom_user, lower_username;
 	fstring real_username;
 	struct passwd *passwd;
@@ -979,8 +978,12 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain,
 
 	*username_was_mapped = map_username(sconn, dom_user);
 
-	if ( !(passwd = smb_getpwnam( NULL, dom_user, real_username, True )) )
+	passwd = smb_getpwnam( NULL, dom_user, real_username, True );
+	if (!passwd) {
+		DEBUG(3, ("Failed to find authenticated user %s via "
+			  "getpwnam(), denying access.\n", dom_user));
 		return NT_STATUS_NO_SUCH_USER;
+	}
 
 	*uid = passwd->pw_uid;
 	*gid = passwd->pw_gid;
@@ -995,7 +998,7 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const char *domain,
 
 	TALLOC_FREE(passwd);
 
-	return nt_status;
+	return NT_STATUS_OK;
 }
 
 /****************************************************************************
@@ -1154,6 +1157,10 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx,
 				     &found_username, &uid, &gid,
 				     &username_was_mapped);
 
+	if (!NT_STATUS_IS_OK(nt_status)) {
+		return nt_status;
+	}
+
 	result = make_server_info(NULL);
 	if (result == NULL) {
 		DEBUG(4, ("make_server_info failed!\n"));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list