diff options
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r-- | source3/modules/vfs_snapper.c | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 1c88a1e4912..2274a56a61a 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2669,21 +2669,27 @@ static int snapper_gmt_chflags(vfs_handle_struct *handle, const char *fname, } static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle, - const char *fname, const char *aname, - void *value, size_t size) + const struct smb_filename *smb_fname, + const char *aname, + void *value, + size_t size) { - 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_GETXATTR(handle, fname, aname, value, + return SMB_VFS_NEXT_GETXATTR(handle, smb_fname, aname, value, size); } conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp); @@ -2691,10 +2697,25 @@ static ssize_t snapper_gmt_getxattr(vfs_handle_struct *handle, if (conv == NULL) { return -1; } - ret = SMB_VFS_NEXT_GETXATTR(handle, conv, aname, value, size); - 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_GETXATTR(handle, conv_smb_fname, aname, value, size); + if (ret == -1) { + saved_errno = errno; + } + TALLOC_FREE(conv_smb_fname); + TALLOC_FREE(conv); + if (saved_errno != 0) { + errno = saved_errno; + } return ret; } |