vfs_streams_xattr: call SMB_VFS_OPEN with smb_fname_base
authorRalph Boehme <slow@samba.org>
Thu, 1 Dec 2016 10:17:48 +0000 (11:17 +0100)
committerUri Simchoni <uri@samba.org>
Wed, 1 Mar 2017 23:32:20 +0000 (00:32 +0100)
In case an SMB_VFS_OPEN() on a stream basename fails with EISDIR, we
retry the open as O_RDONLY. The retry should be done with the
smb_fname_base as well.

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_streams_xattr.c

index 6a7f3e67341232a28a8e1ab0046c10f1a6b3fd32..e193d3572c5460f6e2b7b548eaafe67a150815a5 100644 (file)
@@ -452,18 +452,18 @@ static int streams_xattr_open(vfs_handle_struct *handle,
         hostfd = SMB_VFS_OPEN(handle->conn, smb_fname_base, fsp,
                              baseflags, mode);
 
-       TALLOC_FREE(smb_fname_base);
-
         /* It is legit to open a stream on a directory, but the base
          * fd has to be read-only.
          */
         if ((hostfd == -1) && (errno == EISDIR)) {
                 baseflags &= ~O_ACCMODE;
                 baseflags |= O_RDONLY;
-                hostfd = SMB_VFS_OPEN(handle->conn, smb_fname, fsp, baseflags,
+                hostfd = SMB_VFS_OPEN(handle->conn, smb_fname_base, fsp, baseflags,
                                      mode);
         }
 
+       TALLOC_FREE(smb_fname_base);
+
         if (hostfd == -1) {
                goto fail;
         }