Reported by an OEM. ---------------------------------------------------------------- We use dirsort module in our product, and encounter some problems with this module. Since dirsort module only keeps one private data (i.e., struct dirsort_privates) for per vfs_handle_struct. Once the samba process calls SMB_VFS_OPENDIR multiple times, the previous data will be overwritten, like the following example: dirp1 = SMB_VFS_OPENDIR(dir_a); dirp2 = SMB_VFS_OPENDIR(dir_b); ... SMB_VFS_READDIR(dirp1); // this will get wrong results since the data was overwritten in the second SMB_VFS_OPENDIR() SMB_VFS_READDIR(dirp2); ... SMB_VFS_CLOSEDIR(dirp2); SMB_VFS_CLOSEDIR(dirp1); According to our experiences, this scenario sometimes happens when users use 7- zip to compress a big direcotry (i.e., a directory which contains many sub folders and sub-sub folders). Since dirsort module returns a wrong file list, users will get incorrect archive files. We think the private data should be stored for per dir pointer so that it will not be overwritten by the other SMB_VFS_OPENDIR(). ---------------------------------------------------------------- I have a fix for this to follow.
Created attachment 9621 [details] git-am fix for master. Current patch sent to the OEM for testing.
Response from OEM: Yes, we have tested the patch and it can work correctly now. Thanks for your help !
Created attachment 9678 [details] git-am backport of the fix that went into master. Minor changes around NTSTATUS inside opendir.
Created attachment 9679 [details] git-am fix for 4.1.next Cherry-picked cleanly from master. Andrew please +1 on these two and I'll reassign to Karolin for inclusion in 4.1.next, 4.0.next. Jeremy.
Thanks ! Re-assigning to Karolin for inclusion in 4.1.next, 4.0.next. Jeremy.
(In reply to comment #5) > Thanks ! Re-assigning to Karolin for inclusion in 4.1.next, 4.0.next. > > Jeremy. Pushed to autobuild-v4-1-test and autobuild-v4-0-test.
Pushed to v4-1-test and v4-0-test. Closing out bug report. Thanks!