1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00

s3/torture: use SMB_VFS_OPENAT() in cmd_set_nt_acl()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2020-05-19 21:35:56 +02:00 committed by Jeremy Allison
parent b1d8bb6a40
commit 1a3cf6ba59

View File

@ -1622,6 +1622,7 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
int ret;
mode_t mode;
files_struct *fsp;
struct files_struct *fspcwd = NULL;
struct smb_filename *smb_fname = NULL;
NTSTATUS status;
struct security_descriptor *sd = NULL;
@ -1661,9 +1662,24 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a
flags = O_RDONLY;
#endif
fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, smb_fname, fsp, O_RDWR, 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,
O_RDWR,
mode);
if (fsp->fh->fd == -1 && errno == EISDIR) {
fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, smb_fname, fsp, flags, mode);
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));