vfs_fruit: use SMB_VFS_NEXT_OPEN in two places
authorRalph Boehme <slow@samba.org>
Wed, 8 Feb 2017 18:15:38 +0000 (19:15 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 1 Mar 2017 23:32:21 +0000 (00:32 +0100)
Using the SMB_VFS_OPEN leads to a logic recursion that is hard to follow
and debug. It may be called twice for the same fsp with two different
smb_fname's.

Changing this here to use the NEXT function instead should have no
change in behaviour otherwise, but it allows adding sane caching to
vfs_catia to handle based VFS ops.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12427

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/modules/vfs_fruit.c

index cbd1477059fab657bdf4c090451f492094f2d252..5bb1da9254d0efdd2118255253e573a312057084 100644 (file)
@@ -2529,8 +2529,8 @@ static int fruit_open_meta_netatalk(vfs_handle_struct *handle,
        baseflags &= ~O_EXCL;
        baseflags &= ~O_CREAT;
 
-       hostfd = SMB_VFS_OPEN(handle->conn, smb_fname_base, fsp,
-                             baseflags, mode);
+       hostfd = SMB_VFS_NEXT_OPEN(handle, smb_fname_base, fsp,
+                                  baseflags, mode);
 
        /*
         * It is legit to open a stream on a directory, but the base
@@ -2539,8 +2539,8 @@ static int fruit_open_meta_netatalk(vfs_handle_struct *handle,
        if ((hostfd == -1) && (errno == EISDIR)) {
                baseflags &= ~O_ACCMODE;
                baseflags |= O_RDONLY;
-               hostfd = SMB_VFS_OPEN(handle->conn, smb_fname_base, fsp,
-                                     baseflags, mode);
+               hostfd = SMB_VFS_NEXT_OPEN(handle, smb_fname_base, fsp,
+                                          baseflags, mode);
        }
 
        TALLOC_FREE(smb_fname_base);
@@ -2591,7 +2591,7 @@ exit:
                         * full fsp yet
                         */
                        fsp->fh->fd = hostfd;
-                       SMB_VFS_CLOSE(fsp);
+                       SMB_VFS_NEXT_CLOSE(handle, fsp);
                }
                hostfd = -1;
                errno = saved_errno;
@@ -2681,8 +2681,8 @@ static int fruit_open_rsrc_adouble(vfs_handle_struct *handle,
                flags |= O_RDWR;
        }
 
-       hostfd = SMB_VFS_OPEN(handle->conn, smb_fname_base, fsp,
-                             flags, mode);
+       hostfd = SMB_VFS_NEXT_OPEN(handle, smb_fname_base, fsp,
+                                  flags, mode);
        if (hostfd == -1) {
                rc = -1;
                goto exit;