From: Jeremy Allison Date: Fri, 30 Aug 2019 20:16:01 +0000 (-0700) Subject: s3: VFS: vfs_ceph_snapshots. Implement symlinkat(). X-Git-Tag: tevent-0.10.1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5665a3845a74d72d374ddfc3bea37b9fc4586b15;p=thirdparty%2Fsamba.git s3: VFS: vfs_ceph_snapshots. Implement symlinkat(). Currently identical to symlink(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 93cd66c6253..615bbe20be0 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -826,6 +826,41 @@ static int ceph_snap_gmt_symlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname); } +static int ceph_snap_gmt_symlinkat(vfs_handle_struct *handle, + const char *link_contents, + struct files_struct *dirfsp, + const struct smb_filename *new_smb_fname) +{ + int ret; + time_t timestamp_old = 0; + time_t timestamp_new = 0; + + ret = ceph_snap_gmt_strip_snapshot(handle, + link_contents, + ×tamp_old, + NULL, 0); + if (ret < 0) { + errno = -ret; + return -1; + } + ret = ceph_snap_gmt_strip_snapshot(handle, + new_smb_fname->base_name, + ×tamp_new, + NULL, 0); + if (ret < 0) { + errno = -ret; + return -1; + } + if ((timestamp_old != 0) || (timestamp_new != 0)) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_SYMLINKAT(handle, + link_contents, + dirfsp, + new_smb_fname); +} + static int ceph_snap_gmt_linkat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *old_smb_fname, @@ -1625,6 +1660,7 @@ static struct vfs_fn_pointers ceph_snap_fns = { .renameat_fn = ceph_snap_gmt_renameat, .linkat_fn = ceph_snap_gmt_linkat, .symlink_fn = ceph_snap_gmt_symlink, + .symlinkat_fn = ceph_snap_gmt_symlinkat, .stat_fn = ceph_snap_gmt_stat, .lstat_fn = ceph_snap_gmt_lstat, .open_fn = ceph_snap_gmt_open,