diff options
author | Jeremy Allison <jra@samba.org> | 2017-06-30 11:32:59 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2017-07-01 03:07:11 +0200 |
commit | c29438f8238c3cf436e126c99f6f9f6bcca4efaf (patch) | |
tree | cff5f451fe83b9189eca4ca8f2c9530a8bfc2fa9 /source3/modules/vfs_snapper.c | |
parent | bd9285b19741128bae501b721d9e63dd9a9bd833 (diff) | |
download | samba-c29438f8238c3cf436e126c99f6f9f6bcca4efaf.tar.gz |
s3: VFS: Change SMB_VFS_REALPATH to take and return struct smb_filename * instead of 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: Richard Sharpe <realrichardsharpe@gmail.com>
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r-- | source3/modules/vfs_snapper.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 05d57671db7..9dbb74f8fe9 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2507,39 +2507,47 @@ static int snapper_gmt_mknod(vfs_handle_struct *handle, return ret; } -static char *snapper_gmt_realpath(vfs_handle_struct *handle, - const char *fname) +static struct smb_filename *snapper_gmt_realpath(vfs_handle_struct *handle, + TALLOC_CTX *ctx, + const struct smb_filename *smb_fname) { - time_t timestamp; + time_t timestamp = 0; char *stripped = NULL; - char *tmp = NULL; - char *result = NULL; - int saved_errno; + struct smb_filename *result_fname = NULL; + struct smb_filename *conv_smb_fname = NULL; + int saved_errno = 0; - if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fname, + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + smb_fname->base_name, ×tamp, &stripped)) { goto done; } if (timestamp == 0) { - return SMB_VFS_NEXT_REALPATH(handle, fname); + return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname); } - tmp = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp); - if (tmp == NULL) { + conv_smb_fname = cp_smb_filename(talloc_tos(), smb_fname); + if (conv_smb_fname == NULL) { goto done; } - - result = SMB_VFS_NEXT_REALPATH(handle, tmp); - if (result == NULL) { + conv_smb_fname->base_name = snapper_gmt_convert(conv_smb_fname, handle, + stripped, timestamp); + if (conv_smb_fname->base_name == NULL) { goto done; } + result_fname = SMB_VFS_NEXT_REALPATH(handle, ctx, conv_smb_fname); + done: - saved_errno = errno; - TALLOC_FREE(tmp); + if (result_fname == NULL) { + saved_errno = errno; + } + TALLOC_FREE(conv_smb_fname); TALLOC_FREE(stripped); - errno = saved_errno; - return result; + if (saved_errno != 0) { + errno = saved_errno; + } + return result_fname; } static NTSTATUS snapper_gmt_fget_nt_acl(vfs_handle_struct *handle, |