]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use fdos_mode() in smbd_do_qfilepathinfo()
authorRalph Boehme <slow@samba.org>
Mon, 19 Oct 2020 19:07:35 +0000 (21:07 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:32 +0000 (09:08 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/trans2.c

index c290e74eb55b6cee660729b1c9587ae9c863befd..e1d88c92ea1ae9c3dedebfa3d3b344814d1b23f2 100644 (file)
@@ -5199,7 +5199,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
        unsigned int data_size;
        struct timespec create_time_ts, mtime_ts, atime_ts, ctime_ts;
        time_t create_time, mtime, atime, c_time;
-       SMB_STRUCT_STAT *psbuf = &smb_fname->st;
+       SMB_STRUCT_STAT *psbuf = NULL;
        char *p;
        char *base_name;
        char *dos_fname;
@@ -5222,7 +5222,16 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                 fsp_fnum_dbg(fsp),
                 info_level, max_data_bytes));
 
-       mode = dos_mode(conn, smb_fname);
+       /*
+        * In case of querying a symlink in POSIX context,
+        * fsp will be NULL. fdos_mode() deals with it.
+        */
+       if (fsp != NULL) {
+               smb_fname = fsp->fsp_name;
+       }
+       mode = fdos_mode(fsp);
+       psbuf = &smb_fname->st;
+
        nlink = psbuf->st_ex_nlink;
 
        if (nlink && (mode&FILE_ATTRIBUTE_DIRECTORY)) {