]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Remove "a heuristic to avoid seeking the dirptr"
authorVolker Lendecke <vl@samba.org>
Fri, 16 Jun 2023 11:32:24 +0000 (13:32 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 16 Jun 2023 16:14:31 +0000 (16:14 +0000)
-- we don't seek the dirptr anymore

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

index cac0425723304ab5b90228579649a0008ed52507..bb64e7e73ae32aa15b8ff5961ffd2447d2d8b5fb 100644 (file)
@@ -1116,36 +1116,34 @@ static void call_trans2findfirst(connection_struct *conn,
        for (i=0;(i<maxentries) && !finished && !out_of_space;i++) {
                bool got_exact_match = False;
 
-               /* this is a heuristic to avoid seeking the dirptr except when
-                       absolutely necessary. It allows for a filename of about 40 chars */
-               if (space_remaining < DIRLEN_GUESS && numentries > 0) {
-                       out_of_space = True;
-                       finished = False;
+               ntstatus = get_lanman2_dir_entry(talloc_tos(),
+                                                conn,
+                                                fsp->dptr,
+                                                req->flags2,
+                                                mask,
+                                                dirtype,
+                                                info_level,
+                                                requires_resume_key,
+                                                dont_descend,
+                                                ask_sharemode,
+                                                &p,
+                                                pdata,
+                                                data_end,
+                                                space_remaining,
+                                                &got_exact_match,
+                                                &last_entry_off,
+                                                ea_list);
+               if (NT_STATUS_EQUAL(ntstatus, NT_STATUS_ILLEGAL_CHARACTER)) {
+                       /*
+                        * Bad character conversion on name. Ignore
+                        * this entry.
+                        */
+                       continue;
+               }
+               if (NT_STATUS_EQUAL(ntstatus, STATUS_MORE_ENTRIES)) {
+                       out_of_space = true;
                } else {
-                       ntstatus = get_lanman2_dir_entry(talloc_tos(),
-                                       conn,
-                                       fsp->dptr,
-                                       req->flags2,
-                                       mask,dirtype,info_level,
-                                       requires_resume_key,dont_descend,
-                                       ask_sharemode,
-                                       &p,pdata,data_end,
-                                       space_remaining,
-                                       &got_exact_match,
-                                       &last_entry_off, ea_list);
-                       if (NT_STATUS_EQUAL(ntstatus,
-                                       NT_STATUS_ILLEGAL_CHARACTER)) {
-                               /*
-                                * Bad character conversion on name. Ignore this
-                                * entry.
-                                */
-                               continue;
-                       }
-                       if (NT_STATUS_EQUAL(ntstatus, STATUS_MORE_ENTRIES)) {
-                               out_of_space = true;
-                       } else {
-                               finished = !NT_STATUS_IS_OK(ntstatus);
-                       }
+                       finished = !NT_STATUS_IS_OK(ntstatus);
                }
 
                if (!finished && !out_of_space) {
@@ -1597,36 +1595,34 @@ static void call_trans2findnext(connection_struct *conn,
        for (i=0;(i<(int)maxentries) && !finished && !out_of_space ;i++) {
                bool got_exact_match = False;
 
-               /* this is a heuristic to avoid seeking the fsp->dptr except when
-                       absolutely necessary. It allows for a filename of about 40 chars */
-               if (space_remaining < DIRLEN_GUESS && numentries > 0) {
-                       out_of_space = True;
-                       finished = False;
+               ntstatus = get_lanman2_dir_entry(ctx,
+                                                conn,
+                                                fsp->dptr,
+                                                req->flags2,
+                                                mask,
+                                                dirtype,
+                                                info_level,
+                                                requires_resume_key,
+                                                dont_descend,
+                                                ask_sharemode,
+                                                &p,
+                                                pdata,
+                                                data_end,
+                                                space_remaining,
+                                                &got_exact_match,
+                                                &last_entry_off,
+                                                ea_list);
+               if (NT_STATUS_EQUAL(ntstatus, NT_STATUS_ILLEGAL_CHARACTER)) {
+                       /*
+                        * Bad character conversion on name. Ignore
+                        * this entry.
+                        */
+                       continue;
+               }
+               if (NT_STATUS_EQUAL(ntstatus, STATUS_MORE_ENTRIES)) {
+                       out_of_space = true;
                } else {
-                       ntstatus = get_lanman2_dir_entry(ctx,
-                                               conn,
-                                               fsp->dptr,
-                                               req->flags2,
-                                               mask,dirtype,info_level,
-                                               requires_resume_key,dont_descend,
-                                               ask_sharemode,
-                                               &p,pdata,data_end,
-                                               space_remaining,
-                                               &got_exact_match,
-                                               &last_entry_off, ea_list);
-                       if (NT_STATUS_EQUAL(ntstatus,
-                                       NT_STATUS_ILLEGAL_CHARACTER)) {
-                               /*
-                                * Bad character conversion on name. Ignore this
-                                * entry.
-                                */
-                               continue;
-                       }
-                       if (NT_STATUS_EQUAL(ntstatus, STATUS_MORE_ENTRIES)) {
-                               out_of_space = true;
-                       } else {
-                               finished = !NT_STATUS_IS_OK(ntstatus);
-                       }
+                       finished = !NT_STATUS_IS_OK(ntstatus);
                }
 
                if (!finished && !out_of_space) {