From: Ralph Boehme Date: Tue, 19 May 2020 19:33:00 +0000 (+0200) Subject: s3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct() X-Git-Tag: ldb-2.2.0~370 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1304fd92afc4adbd155baf263531c0cc64ffafa7;p=thirdparty%2Fsamba.git s3/pysmbd: use SMB_VFS_OPENAT() in init_files_struct() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 9f5663e2e43..7f671cf6eeb 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -143,6 +143,8 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx, int ret; mode_t saved_umask; struct files_struct *fsp; + struct files_struct *fspcwd = NULL; + NTSTATUS status; fsp = talloc_zero(mem_ctx, struct files_struct); if (fsp == NULL) { @@ -163,13 +165,23 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx, fsp->fsp_name = smb_fname; + status = vfs_at_fspcwd(fsp, conn, &fspcwd); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + /* * we want total control over the permissions on created files, * so set our umask to 0 (this matters if flags contains O_CREAT) */ saved_umask = umask(0); - fsp->fh->fd = SMB_VFS_OPEN(conn, smb_fname, fsp, flags, 00644); + fsp->fh->fd = SMB_VFS_OPENAT(conn, + fspcwd, + smb_fname, + fsp, + flags, + 00644); umask(saved_umask);