]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: maps NT_STATUS_STOPPED_ON_SYMLINK to NT_STATUS_OBJECT_PATH_NOT_FOUND in open_file()
authorRalph Boehme <slow@samba.org>
Fri, 23 Oct 2020 10:16:38 +0000 (12:16 +0200)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:30 +0000 (09:08 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index 2fff31c716f207a06b668613004c620761e308fb..ef90855ed2cdb70f602a6e5831c9e863288cc28b 100644 (file)
@@ -1366,6 +1366,18 @@ static NTSTATUS open_file(files_struct *fsp,
                                        local_flags & ~O_TRUNC,
                                        unx_mode,
                                        p_file_created);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_STOPPED_ON_SYMLINK)) {
+                       /*
+                        * POSIX client that hit a symlink. We don't want to
+                        * return NT_STATUS_STOPPED_ON_SYMLINK to avoid handling
+                        * this special error code in all callers, so we map
+                        * this to NT_STATUS_OBJECT_PATH_NOT_FOUND. Historically
+                        * the lower level functions returned status code mapped
+                        * from errno by map_nt_error_from_unix() where ELOOP is
+                        * mapped to NT_STATUS_OBJECT_PATH_NOT_FOUND.
+                        */
+                       status = NT_STATUS_OBJECT_PATH_NOT_FOUND;
+               }
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3,("Error opening file %s (%s) (local_flags=%d) "
                                 "(flags=%d)\n", smb_fname_str_dbg(smb_fname),