From b279ee16e982d419c2205a7f790bd9cb8035d6e5 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 7 Jun 2005 17:52:19 +0000 Subject: r7372: abartet's patch for BUG 2391 (segv caused by free a static pointer) (This used to be commit 4cda2bd035276bd090bf0fbd4e3b2eff657a80cb) --- source3/auth/auth_server.c | 1 + source3/auth/auth_util.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'source3/auth') diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index bc611ec229..7bce32ef2b 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -384,6 +384,7 @@ use this machine as the password server.\n")); real_username, True )) != NULL ) { nt_status = make_server_info_pw(server_info, pass->pw_name, pass); + passwd_free(&pass); } else { diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 31bfa2fe01..021f780112 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -958,6 +958,7 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx, uid_t *uid, gid_t *gid, SAM_ACCOUNT **sam_account) { + NTSTATUS nt_status; fstring dom_user, lower_username; fstring real_username; struct passwd *passwd; @@ -992,7 +993,9 @@ static NTSTATUS fill_sam_account(TALLOC_CTX *mem_ctx, DEBUG(5,("fill_sam_account: located username was [%s]\n", *found_username)); - return pdb_init_sam_pw(sam_account, passwd); + nt_status = pdb_init_sam_pw(sam_account, passwd); + passwd_free(&passwd); + return nt_status; } /**************************************************************************** @@ -1024,7 +1027,7 @@ struct passwd *smb_getpwnam( char *domuser, fstring save_username, BOOL create ) if ( p ) { fstring strip_username; - pw = Get_Pwnam( domuser ); + pw = Get_Pwnam_alloc( domuser ); if ( pw ) { /* make sure we get the case of the username correct */ /* work around 'winbind use default domain = yes' */ @@ -1055,7 +1058,7 @@ struct passwd *smb_getpwnam( char *domuser, fstring save_username, BOOL create ) /* just lookup a plain username */ - pw = Get_Pwnam(username); + pw = Get_Pwnam_alloc(username); /* Create local user if requested. */ @@ -1065,7 +1068,7 @@ struct passwd *smb_getpwnam( char *domuser, fstring save_username, BOOL create ) return NULL; smb_create_user(NULL, username, NULL); - pw = Get_Pwnam(username); + pw = Get_Pwnam_alloc(username); } /* one last check for a valid passwd struct */ -- cgit