s3/torture: use SMB_VFS_OPENAT() in cmd_open()
authorRalph Boehme <slow@samba.org>
Tue, 19 May 2020 19:34:26 +0000 (21:34 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 21 May 2020 20:38:34 +0000 (20:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/cmd_vfs.c

index 3c16b73310a71e66178ea66dd3d296decec9f60c..3e23760741098895dbacbfe4c4599d60bf03218a 100644 (file)
@@ -294,6 +294,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
        mode_t mode;
        const char *flagstr;
        files_struct *fsp;
+       struct files_struct *fspcwd = NULL;
        struct smb_filename *smb_fname = NULL;
        NTSTATUS status;
        int ret;
@@ -393,7 +394,17 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
 
        fsp->fsp_name = smb_fname;
 
-       fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, smb_fname, fsp, flags, mode);
+       status = vfs_at_fspcwd(fsp, vfs->conn, &fspcwd);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       fsp->fh->fd = SMB_VFS_OPENAT(vfs->conn,
+                                    fspcwd,
+                                    smb_fname,
+                                    fsp,
+                                    flags,
+                                    mode);
        if (fsp->fh->fd == -1) {
                printf("open: error=%d (%s)\n", errno, strerror(errno));
                TALLOC_FREE(fsp);