From 588c84d488289c069822ac87f645049f328afd1c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 26 Aug 2019 10:07:32 -0700 Subject: [PATCH] s3: libsmbclient: Ensure SMBC_getdents_ctx() also updates the readdirplus pointers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If we are returning file entries, we have a duplicate list in dirplus. Update dirplus_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 Reviewed-by: Ralph Böhme (cherry picked from commit 754cec7756b2ddb1cfcc3984265f01cb366beb76) --- source3/libsmb/libsmb_dir.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index b51a4c13775..ff2948c9b69 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -1357,6 +1357,17 @@ SMBC_getdents_ctx(SMBCCTX *context, } dir->dir_next = dirlist = dirlist -> next; + + /* + * If we are returning file entries, we + * have a duplicate list in dirplus. + * + * Update dirplus_next also so readdir and + * readdirplus are kept in sync. + */ + if (dir->dirplus_list != NULL) { + dir->dirplus_next = dir->dirplus_next->next; + } } TALLOC_FREE(frame); -- 2.47.2