]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Slightly simplify smbd_dirptr_lanman2_entry()'s overflow logic
authorVolker Lendecke <vl@samba.org>
Fri, 9 Jun 2023 12:44:58 +0000 (14:44 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 13 Jun 2023 23:33:39 +0000 (23:33 +0000)
No caller does anything with the smb_fname upon overflow, so we might
as well do an early return.

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

index 648893a859601327eb756a5476e8b2ba9e774f1e..ab233da3518610ef2806571df7f87368b81760f3 100644 (file)
@@ -2003,9 +2003,11 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
                *file_id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
        }
 
-       if (!NT_STATUS_IS_OK(status) &&
-           !NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES))
-       {
+       if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
+               dptr_SeekDir(dirptr, prev_dirpos);
+       }
+
+       if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(smb_fname);
                TALLOC_FREE(fname);
                return status;
@@ -2035,11 +2037,6 @@ NTSTATUS smbd_dirptr_lanman2_entry(TALLOC_CTX *ctx,
        }
        TALLOC_FREE(fname);
 
-       if (NT_STATUS_EQUAL(status, STATUS_MORE_ENTRIES)) {
-               dptr_SeekDir(dirptr, prev_dirpos);
-               return status;
-       }
-
        *_last_entry_off = last_entry_off;
        return NT_STATUS_OK;
 }