Samba version 4.15.13 [share1]$ mkdir folder ; chmod 700 folder [share1]$ ls -al . total 16 drwxrwxrwx 4 admin administrators 4096 2023-08-15 16:12 ./ drwxrwxrwx 41 admin administrators 4096 2023-08-15 16:12 ../ drwx------ 2 mike everyone 4096 2023-08-15 16:12 folder/ --- If aio_pthread is loaded, folder(or file) doesn't show when user doesn't have permission [global] vfs objects = aio_pthread $ smbclient //localhost/share1 -U aaa -c 'ls' . D 0 Tue Aug 15 16:12:49 2023 .. D 0 Tue Aug 15 16:12:01 2023 If aio_pthread is not loaded, folder is shown. [global] vfs objects = $ smbclient //localhost/share1 -U aaa -c 'ls' . D 0 Tue Aug 15 16:12:49 2023 .. D 0 Tue Aug 15 16:12:01 2023 folder D 0 Tue Aug 15 16:12:49 2023 strace can show the difference: * aio_pthread is not loaded openat(45, "second", O_RDONLY|O_DIRECTORY |O_PATH ) = 15 * aio_pthread is loaded openat(15, "second", O_RDONLY|O_DIRECTORY) = -1 EACCES (Permission denied) --- After commit cf3c48cb08811e45b6d88a4c27b873485321beb0 vfswrap_openat() support O_PATH (pathref) but aio_pthread_openat_fn not. Should we use SMB_VFS_NEXT_OPENAT if aio_allow_open = false ? static int aio_pthread_openat_fn(vfs_handle_struct *handle, const struct files_struct *dirfsp, const struct smb_filename *smb_fname, struct files_struct *fsp, int flags, mode_t mode) { /* ... */ if (!aio_allow_open) { /* aio opens turned off. */ - return openat(fsp_get_pathref_fd(dirfsp), - smb_fname->base_name, - flags, - mode); + return SMB_VFS_NEXT_OPENAT(handle, + dirfsp, + smb_fname, + fsp, + flags, + mode); } /* ... */ }
Yes, inside aio_pthread_openat_fn() it's safe to call SMB_VFS_NEXT_OPENAT() for all the existing openat() calls. Obviously not for the openat() inside aio_open_do() of course.
patch : https://gitlab.com/mikeliu_qnap/samba/-/commit/34c4b0ad087a317ece85c9c5d3abd252ec1c20ec CI pipeline is passed. https://gitlab.com/mikeliu_qnap/samba/-/pipelines/969168360 Merge request: https://gitlab.com/samba-team/samba/-/merge_requests/3226
Make some modifications due to metze's comment patch : https://gitlab.com/samba-team/samba/-/merge_requests/3226/diffs?commit_id=08b73db6ed873695fa08adcfb5dcc2fddc597a74 CI pipeline is passed. https://gitlab.com/samba-team/samba/-/commit/08b73db6ed873695fa08adcfb5dcc2fddc597a74 Merge request: https://gitlab.com/samba-team/samba/-/merge_requests/3226
This bug was referenced in samba master: 81226b5179e6ba806a0a690806ca2f9004f7c9f9
Created attachment 18067 [details] git-am fix for 4.19.next, 4.18.next. 4.17.next Cherry-picked from master. Applies cleanly to all branches.
Pushed to autobuild-v4-{19,18,17}-test.
This bug was referenced in samba v4-17-test: 1361e545452faca0d2f85d4a82aa06535c129d76
This bug was referenced in samba v4-18-test: 14380eb832dff7f6c9e80206f2035bfb4a8e1a6b
This bug was referenced in samba v4-19-test: 8a34b378932930825f4c189d2f0bcacb682ff816
Closing out bug report. Thanks!
This bug was referenced in samba v4-19-stable (Release samba-4.19.0): 8a34b378932930825f4c189d2f0bcacb682ff816
This bug was referenced in samba v4-17-stable (Release samba-4.17.11): 1361e545452faca0d2f85d4a82aa06535c129d76
This bug was referenced in samba v4-18-stable (Release samba-4.18.7): 14380eb832dff7f6c9e80206f2035bfb4a8e1a6b