From: Jeremy Allison Date: Mon, 26 Aug 2019 17:02:47 +0000 (-0700) Subject: s3: libsmbclient: Ensure SMBC_readdirplus_ctx() also updates the readdir pointers. X-Git-Tag: samba-4.9.14~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b44cc7f07e38876a9a84db2c5614b62acc500c02;p=thirdparty%2Fsamba.git s3: libsmbclient: Ensure SMBC_readdirplus_ctx() also updates the readdir pointers. 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 Reviewed-by: Ralph Böhme (cherry picked from commit 3d82b7d11cd7b78adc6b3642e64e3a8f251de869) --- diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 35215fdfbb5..b51a4c13775 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -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; }