diff options
author | Jeremy Allison <jra@samba.org> | 2017-05-25 12:41:31 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-05-31 22:50:22 +0200 |
commit | 48956fa4d3b37105ad3e8e742c21b5583d79db11 (patch) | |
tree | 0c90dd34b5be384c8791df622bf490fc065dd192 /source3/modules/vfs_snapper.c | |
parent | 12b801d9d7856f1bb50619962f7e9cb94e75087f (diff) | |
download | samba-48956fa4d3b37105ad3e8e742c21b5583d79db11.tar.gz |
s3: VFS: Change SMB_VFS_SETXATTR to use const struct smb_filename * instead of const char *.
We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r-- | source3/modules/vfs_snapper.c | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 49e2c61f50c..1c88a1e4912 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2795,33 +2795,53 @@ static int snapper_gmt_removexattr(vfs_handle_struct *handle, } static int snapper_gmt_setxattr(struct vfs_handle_struct *handle, - const char *fname, + const struct smb_filename *smb_fname, const char *aname, const void *value, size_t size, int flags) { - time_t timestamp; - char *stripped; + time_t timestamp = 0; + char *stripped = NULL; ssize_t ret; - int saved_errno; - char *conv; + int saved_errno = 0; + char *conv = NULL; + struct smb_filename *conv_smb_fname = NULL; - if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname, - ×tamp, &stripped)) { + if (!snapper_gmt_strip_snapshot(talloc_tos(), + handle, + smb_fname->base_name, + ×tamp, + &stripped)) { return -1; } if (timestamp == 0) { - return SMB_VFS_NEXT_SETXATTR(handle, fname, aname, value, size, - flags); + return SMB_VFS_NEXT_SETXATTR(handle, smb_fname, + aname, value, size, flags); } conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp); TALLOC_FREE(stripped); if (conv == NULL) { return -1; } - ret = SMB_VFS_NEXT_SETXATTR(handle, conv, aname, value, size, flags); - saved_errno = errno; + conv_smb_fname = synthetic_smb_fname(talloc_tos(), + conv, + NULL, + NULL, + smb_fname->flags); TALLOC_FREE(conv); - errno = saved_errno; + if (conv_smb_fname == NULL) { + errno = ENOMEM; + return -1; + } + ret = SMB_VFS_NEXT_SETXATTR(handle, conv_smb_fname, + aname, value, size, flags); + if (ret == -1) { + saved_errno = errno; + } + TALLOC_FREE(conv_smb_fname); + TALLOC_FREE(conv); + if (saved_errno != 0) { + errno = saved_errno; + } return ret; } |