]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify filename_convert_dirfsp_nosymlink()
authorVolker Lendecke <vl@samba.org>
Tue, 20 Dec 2022 13:40:26 +0000 (14:40 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 22 Dec 2022 19:50:34 +0000 (19:50 +0000)
Avoid a nested if, the "&&" is easier to understand for me.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/filename.c

index a7cf7a14d92411bce9e94f87574407923999ac54..be24854f89ca94625fdfe6b22b93704b41898053 100644 (file)
@@ -1268,19 +1268,11 @@ static NTSTATUS filename_convert_dirfsp_nosymlink(
 #endif
        }
 
-       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) &&
+           !VALID_STAT(smb_fname_rel->st)) {
 
                char *normalized = NULL;
 
-               if (VALID_STAT(smb_fname_rel->st)) {
-                       /*
-                        * NT_STATUS_OBJECT_NAME_NOT_FOUND is
-                        * misleading: The object exists but might be
-                        * a symlink pointing outside the share.
-                        */
-                       goto fail;
-               }
-
                /*
                 * Creating a new file
                 */