]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Convert get_real_filename_full_scan() to OpenDir_ntstatus()
authorVolker Lendecke <vl@samba.org>
Mon, 21 Feb 2022 16:43:17 +0000 (17:43 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 22 Feb 2022 09:21:29 +0000 (09:21 +0000)
Get us a better error message without going through the lossy errno.

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

index 73291c35f6ee7a6fbad9138b5181f847e5d6ed65..33aed86718f2af84633fa2db57b98e29cb279608 100644 (file)
@@ -1546,6 +1546,7 @@ int get_real_filename_full_scan(connection_struct *conn,
        char *unmangled_name = NULL;
        long curpos;
        struct smb_filename *smb_fname = NULL;
+       NTSTATUS status;
 
        /* handle null paths */
        if ((path == NULL) || (*path == 0)) {
@@ -1598,10 +1599,15 @@ int get_real_filename_full_scan(connection_struct *conn,
        }
 
        /* open the directory */
-       if (!(cur_dir = OpenDir(talloc_tos(), conn, smb_fname, NULL, 0))) {
-               DEBUG(3,("scan dir didn't open dir [%s]\n",path));
+       status = OpenDir_ntstatus(
+               talloc_tos(), conn, smb_fname, NULL, 0, &cur_dir);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_NOTICE("scan dir didn't open dir [%s]: %s\n",
+                          path,
+                          nt_errstr(status));
                TALLOC_FREE(unmangled_name);
                TALLOC_FREE(smb_fname);
+               errno = map_errno_from_nt_status(status);
                return -1;
        }