From: Jeremy Allison Date: Wed, 21 Aug 2019 18:03:41 +0000 (-0700) Subject: s3: VFS: vfs_snapper. Implement mknodat(). X-Git-Tag: tevent-0.10.1~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ce3cd31004f42296f7672301c4230842d483044;p=thirdparty%2Fsamba.git s3: VFS: vfs_snapper. Implement mknodat(). Currently identical to mknod(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 2da3265e147..f13b69ab8d0 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2400,6 +2400,30 @@ static int snapper_gmt_mknod(vfs_handle_struct *handle, return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev); } +static int snapper_gmt_mknodat(vfs_handle_struct *handle, + files_struct *dirfsp, + const struct smb_filename *smb_fname, + mode_t mode, + SMB_DEV_T dev) +{ + time_t timestamp = (time_t)0; + + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + smb_fname->base_name, + ×tamp, NULL)) { + return -1; + } + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_MKNODAT(handle, + dirfsp, + smb_fname, + mode, + dev); +} + static struct smb_filename *snapper_gmt_realpath(vfs_handle_struct *handle, TALLOC_CTX *ctx, const struct smb_filename *smb_fname) @@ -2882,6 +2906,7 @@ static struct vfs_fn_pointers snapper_fns = { .ntimes_fn = snapper_gmt_ntimes, .readlink_fn = snapper_gmt_readlink, .mknod_fn = snapper_gmt_mknod, + .mknodat_fn = snapper_gmt_mknodat, .realpath_fn = snapper_gmt_realpath, .get_nt_acl_fn = snapper_gmt_get_nt_acl, .fget_nt_acl_fn = snapper_gmt_fget_nt_acl,