s3: vfs: Remove use of lp_posix_pathnames() below the VFS.
authorJeremy Allison <jra@samba.org>
Sat, 19 Mar 2016 04:31:22 +0000 (21:31 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 24 Mar 2016 21:57:16 +0000 (22:57 +0100)
We don't have access to a struct smb_filename here and
can't get one, so simply always set AT_SYMLINK_NOFOLLOW
and remove the optimization if we ended up fstatat()'ing
a symlink, as we don't know if the caller wanted a link
stat or not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_default.c

index 65a14dfa9bcebb3340032694380f4530e163f497..a7004a0d753c720b96c3aff314a6d97f3cd4e46c 100644 (file)
@@ -419,13 +419,20 @@ static struct dirent *vfswrap_readdir(vfs_handle_struct *handle,
                if (result != NULL) {
                        /* See if we can efficiently return this. */
                        struct stat st;
-                       int flags = (lp_posix_pathnames() ?
-                               AT_SYMLINK_NOFOLLOW : 0);
+                       int flags = AT_SYMLINK_NOFOLLOW;
                        int ret = fstatat(dirfd(dirp),
                                        result->d_name,
                                        &st,
                                        flags);
-                       if (ret == 0) {
+                       /*
+                        * As this is an optimization,
+                        * ignore it if we stat'ed a
+                        * symlink. Make the caller
+                        * do it again as we don't
+                        * know if they wanted the link
+                        * info, or its target info.
+                        */
+                       if ((ret == 0) && (!S_ISLNK(st.st_mode))) {
                                init_stat_ex_from_stat(sbuf,
                                        &st,
                                        lp_fake_directory_create_times(