From e129384d7c1df664e447186673dd107e190e2894 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Mon, 22 Jun 2009 15:26:56 -0700 Subject: s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT This patch introduces two new temporary helper functions vfs_stat_smb_fname and vfs_lstat_smb_fname. They basically allowed me to call the new smb_filename version of stat, while avoiding plumbing it through callers that are still too inconvenient. As the conversion moves along, I will be able to remove callers of this, with the goal being to remove all callers. There was also a bug in create_synthetic_smb_fname_split (also a temporary utility function) that caused it to incorrectly handle filenames with ':'s in them when in posix mode. This is now fixed. --- source3/modules/vfs_gpfs.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'source3/modules/vfs_gpfs.c') diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 26f9688909..47858cb352 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -966,20 +966,28 @@ static size_t gpfs_get_xattr(struct vfs_handle_struct *handle, const char *path return size; } -static int vfs_gpfs_stat(struct vfs_handle_struct *handle, const char *fname, - SMB_STRUCT_STAT *sbuf) +static int vfs_gpfs_stat(struct vfs_handle_struct *handle, + struct smb_filename *smb_fname) { struct gpfs_winattr attrs; + char *fname = NULL; + NTSTATUS status; int ret; - ret = SMB_VFS_NEXT_STAT(handle, fname, sbuf); + ret = SMB_VFS_NEXT_STAT(handle, smb_fname); if (ret == -1) { return -1; } + status = get_full_smb_filename(talloc_tos(), smb_fname, &fname); + if (!NT_STATUS_IS_OK) { + errno = map_errno_from_nt_status(status); + return -1; + } ret = get_gpfs_winattrs(CONST_DISCARD(char *, fname), &attrs); + TALLOC_FREE(fname); if (ret == 0) { - sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec; - sbuf->st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; + smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec; + smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; } return 0; } @@ -1005,20 +1013,28 @@ static int vfs_gpfs_fstat(struct vfs_handle_struct *handle, return 0; } -static int vfs_gpfs_lstat(struct vfs_handle_struct *handle, const char *path, - SMB_STRUCT_STAT *sbuf) +static int vfs_gpfs_lstat(struct vfs_handle_struct *handle, + struct smb_filename *smb_fname) { struct gpfs_winattr attrs; + char *path = NULL; + NTSTATUS status; int ret; - ret = SMB_VFS_NEXT_LSTAT(handle, path, sbuf); + ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname); if (ret == -1) { return -1; } + status = get_full_smb_filename(talloc_tos(), smb_fname, &path); + if (!NT_STATUS_IS_OK) { + errno = map_errno_from_nt_status(status); + return -1; + } ret = get_gpfs_winattrs(CONST_DISCARD(char *, path), &attrs); + TALLOC_FREE(path); if (ret == 0) { - sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec; - sbuf->st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; + smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec; + smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec; } return 0; } -- cgit