]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2019-10197: smbd: separate out impersonation debug info into a new function.
authorJeremy Allison <jra@samba.org>
Fri, 12 Jul 2019 19:10:35 +0000 (12:10 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 28 Aug 2019 07:39:46 +0000 (09:39 +0200)
Will be called on elsewhere on successful impersonation.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14035

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/uid.c

index ced2d450f8e79c5145dce3773ec52fbc488cf101..89f539ed430079016e05a9b42c5b02c316c1afe1 100644 (file)
@@ -284,6 +284,28 @@ static bool check_user_ok(connection_struct *conn,
        return(True);
 }
 
+static void print_impersonation_info(connection_struct *conn)
+{
+       struct smb_filename *cwdfname = NULL;
+
+       if (!CHECK_DEBUGLVL(DBGLVL_INFO)) {
+               return;
+       }
+
+       cwdfname = vfs_GetWd(talloc_tos(), conn);
+       if (cwdfname == NULL) {
+               return;
+       }
+
+       DBG_INFO("Impersonated user: uid=(%d,%d), gid=(%d,%d), cwd=[%s]\n",
+                (int)getuid(),
+                (int)geteuid(),
+                (int)getgid(),
+                (int)getegid(),
+                cwdfname->base_name);
+       TALLOC_FREE(cwdfname);
+}
+
 /****************************************************************************
  Become the user of a connection number without changing the security context
  stack, but modify the current_user entries.
@@ -420,20 +442,7 @@ static bool change_to_user_internal(connection_struct *conn,
                current_user.done_chdir = true;
        }
 
-       if (CHECK_DEBUGLVL(DBGLVL_INFO)) {
-               struct smb_filename *cwdfname = vfs_GetWd(talloc_tos(), conn);
-               if (cwdfname == NULL) {
-                       return false;
-               }
-               DBG_INFO("Impersonated user: uid=(%d,%d), gid=(%d,%d), cwd=[%s]\n",
-                        (int)getuid(),
-                        (int)geteuid(),
-                        (int)getgid(),
-                        (int)getegid(),
-                        cwdfname->base_name);
-               TALLOC_FREE(cwdfname);
-       }
-
+       print_impersonation_info(conn);
        return true;
 }