[SCM] Samba Shared Repository - branch v4-15-test updated

Jule Anger janger at samba.org
Tue Feb 15 08:58:01 UTC 2022


The branch, v4-15-test has been updated
       via  3bb0efcdded smbd: Safeguards for getpwuid
      from  1d0ba388223 s3:modules: Fix virusfilter_vfs_openat

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-15-test


- Log -----------------------------------------------------------------
commit 3bb0efcdded566e9788479e2b903adbf22af49fb
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Feb 3 13:20:11 2022 +0100

    smbd: Safeguards for getpwuid
    
    Attempt to fix
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14900
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 929ccd3d1afb864ea715fa4d3d8af8f997e5d2aa)
    
    Autobuild-User(v4-15-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-15-test): Tue Feb 15 08:57:55 UTC 2022 on sn-devel-184

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

Summary of changes:
 source3/passdb/pdb_interface.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 3c4499a4459..b83cef1de37 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1402,6 +1402,7 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 {
 	struct samu *sampw = NULL;
 	struct passwd *unix_pw;
+	fstring pw_name = { 0 };
 	bool ret;
 
 	unix_pw = getpwuid( uid );
@@ -1412,14 +1413,23 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
 		return False;
 	}
 
+	if (unix_pw->pw_name == NULL) {
+		DBG_DEBUG("No pw_name for uid %d\n", (int)uid);
+		return false;
+	}
+
+	/*
+	 * Make a copy, "unix_pw" might go away soon.
+	 */
+	fstrcpy(pw_name, unix_pw->pw_name);
+
 	if ( !(sampw = samu_new( NULL )) ) {
 		DEBUG(0,("pdb_default_uid_to_sid: samu_new() failed!\n"));
 		return False;
 	}
 
 	become_root();
-	ret = NT_STATUS_IS_OK(
-		methods->getsampwnam(methods, sampw, unix_pw->pw_name ));
+	ret = NT_STATUS_IS_OK(methods->getsampwnam(methods, sampw, pw_name));
 	unbecome_root();
 
 	if (!ret) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list