]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: implement SMB_VFS_OPENAT()
authorRalph Boehme <slow@samba.org>
Wed, 20 May 2020 21:01:54 +0000 (23:01 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 21 May 2020 20:38:32 +0000 (20:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index 054f6022b4800441d3ae3a4aa7fbbf47ef8b3658..06dd53e2d4ff7977b968c0b16aeae6ba88587366 100644 (file)
@@ -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,