]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: libsmbclient: Ensure SMBC_readdirplus_ctx() also updates the readdir pointers.
authorJeremy Allison <jra@samba.org>
Mon, 26 Aug 2019 17:02:47 +0000 (10:02 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 19 Sep 2019 07:04:30 +0000 (07:04 +0000)
If we are returning file entries, we
have a duplicate list in dir_list.

Update dir_next also so readdir and
readdirplus are kept in sync.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14094

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
(cherry picked from commit 3d82b7d11cd7b78adc6b3642e64e3a8f251de869)

source3/libsmb/libsmb_dir.c

index 35215fdfbb5c077675fee1ef308e9013cd3ed69c..b51a4c1377552a5c3025830f38ce6170910b381c 100644 (file)
@@ -1230,6 +1230,17 @@ SMBC_readdirplus_ctx(SMBCCTX *context,
        }
        dir->dirplus_next = dir->dirplus_next->next;
 
+       /*
+        * If we are returning file entries, we
+        * have a duplicate list in dir_list
+        *
+        * Update dir_next also so readdir and
+        * readdirplus are kept in sync.
+        */
+       if (dir->dir_list) {
+               dir->dir_next = dir->dir_next->next;
+       }
+
        TALLOC_FREE(frame);
        return smb_finfo;
 }