From: Ralph Boehme Date: Wed, 20 May 2020 21:01:54 +0000 (+0200) Subject: vfs_default: implement SMB_VFS_OPENAT() X-Git-Tag: ldb-2.2.0~394 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39b2da610fe1d1115743e14c626a4e1bc7b7deb2;p=thirdparty%2Fsamba.git vfs_default: implement SMB_VFS_OPENAT() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 054f6022b48..06dd53e2d4f 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -688,6 +688,29 @@ static int vfswrap_open(vfs_handle_struct *handle, return result; } +static int vfswrap_openat(vfs_handle_struct *handle, + const struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + files_struct *fsp, + int flags, + mode_t mode) +{ + int result; + + START_PROFILE(syscall_openat); + + if (is_named_stream(smb_fname)) { + errno = ENOENT; + result = -1; + goto out; + } + + result = openat(dirfsp->fh->fd, smb_fname->base_name, flags, mode); + +out: + END_PROFILE(syscall_openat); + return result; +} static NTSTATUS vfswrap_create_file(vfs_handle_struct *handle, struct smb_request *req, struct files_struct **dirfsp, @@ -3679,6 +3702,7 @@ static struct vfs_fn_pointers vfs_default_fns = { /* File operations */ .open_fn = vfswrap_open, + .openat_fn = vfswrap_openat, .create_file_fn = vfswrap_create_file, .close_fn = vfswrap_close, .pread_fn = vfswrap_pread,