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>
Wed, 18 Sep 2019 12:32:26 +0000 (12:32 +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 a3ec9a8ff717fe489a4f8e3c78d1e1b481f6b575..2f2117e8131a398614c5b1560b330de1a4818266 100644 (file)
@@ -1231,6 +1231,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;
 }