]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Don't print cwd before tcon is done
authorVolker Lendecke <vl@samba.org>
Mon, 21 Oct 2024 10:20:55 +0000 (12:20 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 12 Nov 2024 13:44:32 +0000 (13:44 +0000)
vfs_GetWd depends upon a current tcon in fake_acls, otherwise it will
call openat with an invalid dirfd on a relative pathname.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/uid.c

index e8f51003a1e4118a2354c5a6df4c2f7b9f5f98b3..74ab3d9dd08ae0b94688cce9d9aef2f037c6ac2c 100644 (file)
@@ -453,9 +453,8 @@ static void print_impersonation_info(connection_struct *conn)
                return;
        }
 
-       cwdfname = vfs_GetWd(talloc_tos(), conn);
-       if (cwdfname == NULL) {
-               return;
+       if (conn->tcon_done) {
+               cwdfname = vfs_GetWd(talloc_tos(), conn);
        }
 
        DBG_INFO("Impersonated user: uid=(%d,%d), gid=(%d,%d), cwd=[%s]\n",
@@ -463,7 +462,7 @@ static void print_impersonation_info(connection_struct *conn)
                 (int)geteuid(),
                 (int)getgid(),
                 (int)getegid(),
-                cwdfname->base_name);
+                cwdfname ? cwdfname->base_name : "no cwd");
        TALLOC_FREE(cwdfname);
 }