[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Sat Jul 1 05:21:04 UTC 2017


The branch, master has been updated
       via  51c1a2a s3: VFS: Change SMB_VFS_CONNECTPATH to take const struct smb_filename * instead of const char *.
       via  a665ed4 S3: smbd: Finish plumbing struct smb_filename * through the check_name() stack.
       via  f2588ed s3: smbd: Add missing out of memory check.
       via  c29438f s3: VFS: Change SMB_VFS_REALPATH to take and return struct smb_filename * instead of char *.
       via  bd9285b s3: VFS: Change SMB_VFS_GETWD to return struct smb_filename * instead of char *.
       via  6acb0d6 s3: VFS: Change SMB_VFS_CHDIR to use const struct smb_filename * instead of const char *.
      from  73bee8b show-deleted: Rename attr_filter to exclude_filter for clarity

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 51c1a2a45861c725f756f60ca05e6d1fa4ca34c6
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 30 13:37:03 2017 -0700

    s3: VFS: Change SMB_VFS_CONNECTPATH to take 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 at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Jul  1 07:20:28 CEST 2017 on sn-devel-144

commit a665ed4eea92adba91195f8096c93a2dfd31dbe4
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 30 11:59:20 2017 -0700

    S3: smbd: Finish plumbing struct smb_filename * through the check_name() stack.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

commit f2588ed689b813d10034c117b02a3399df63ad4f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 30 11:34:13 2017 -0700

    s3: smbd: Add missing out of memory check.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

commit c29438f8238c3cf436e126c99f6f9f6bcca4efaf
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jun 30 11:32:59 2017 -0700

    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 at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

commit bd9285b19741128bae501b721d9e63dd9a9bd833
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 29 14:32:47 2017 -0700

    s3: VFS: Change SMB_VFS_GETWD to 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 at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

commit 6acb0d6ca08d72f776d3ba9dc934261a481aa737
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 29 11:29:33 2017 -0700

    s3: VFS: Change SMB_VFS_CHDIR 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 at samba.org>
    Reviewed-by: Richard Sharpe <realrichardsharpe at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 examples/VFS/skel_opaque.c                |  12 +-
 examples/VFS/skel_transparent.c           |  20 +--
 lib/util/memcache.c                       |   1 +
 source3/include/vfs.h                     |  36 +++--
 source3/include/vfs_macros.h              |  32 ++---
 source3/modules/vfs_acl_common.c          |  27 ++--
 source3/modules/vfs_cap.c                 |  62 +++++++-
 source3/modules/vfs_catia.c               |  50 +++++--
 source3/modules/vfs_ceph.c                |  37 +++--
 source3/modules/vfs_default.c             |  46 ++++--
 source3/modules/vfs_dirsort.c             |  10 +-
 source3/modules/vfs_fake_dfq.c            |  57 +++++---
 source3/modules/vfs_full_audit.c          |  36 ++---
 source3/modules/vfs_glusterfs.c           |  36 +++--
 source3/modules/vfs_media_harmony.c       |  60 ++++----
 source3/modules/vfs_netatalk.c            |  25 ++--
 source3/modules/vfs_preopen.c             |   3 +-
 source3/modules/vfs_shadow_copy2.c        | 105 ++++++++------
 source3/modules/vfs_snapper.c             |  84 +++++++----
 source3/modules/vfs_time_audit.c          |  37 +++--
 source3/modules/vfs_unityed_media.c       |  41 +++---
 source3/printing/nt_printing.c            |  21 +--
 source3/rpc_server/srvsvc/srv_srvsvc_nt.c |  31 ++--
 source3/smbd/dir.c                        |  23 +--
 source3/smbd/filename.c                   |  30 ++--
 source3/smbd/msdfs.c                      |  75 ++++++----
 source3/smbd/open.c                       | 150 ++++++++++++-------
 source3/smbd/proto.h                      |  20 ++-
 source3/smbd/reply.c                      |  46 +++---
 source3/smbd/service.c                    |  52 +++++--
 source3/smbd/vfs.c                        | 231 +++++++++++++++++-------------
 source3/torture/cmd_vfs.c                 |  21 ++-
 source3/torture/torture.c                 |  82 ++++++++---
 33 files changed, 1009 insertions(+), 590 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index d5c468e..74ffb67 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -412,13 +412,15 @@ static int skel_lchown(vfs_handle_struct *handle,
 	return -1;
 }
 
-static int skel_chdir(vfs_handle_struct *handle, const char *path)
+static int skel_chdir(vfs_handle_struct *handle,
+			const struct smb_filename *smb_fname)
 {
 	errno = ENOSYS;
 	return -1;
 }
 
-static char *skel_getwd(vfs_handle_struct *handle)
+static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
+				TALLOC_CTX *ctx)
 {
 	errno = ENOSYS;
 	return NULL;
@@ -510,7 +512,9 @@ static int skel_mknod(vfs_handle_struct *handle,
 	return -1;
 }
 
-static char *skel_realpath(vfs_handle_struct *handle, const char *path)
+static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
+			TALLOC_CTX *ctx,
+			const struct smb_filename *smb_fname)
 {
 	errno = ENOSYS;
 	return NULL;
@@ -610,7 +614,7 @@ static int skel_get_real_filename(struct vfs_handle_struct *handle,
 }
 
 static const char *skel_connectpath(struct vfs_handle_struct *handle,
-				    const char *filename)
+				const struct smb_filename *smb_fname)
 {
 	errno = ENOSYS;
 	return NULL;
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 9387276..e584d51 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -515,14 +515,16 @@ static int skel_lchown(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);
 }
 
-static int skel_chdir(vfs_handle_struct *handle, const char *path)
+static int skel_chdir(vfs_handle_struct *handle,
+			const struct smb_filename *smb_fname)
 {
-	return SMB_VFS_NEXT_CHDIR(handle, path);
+	return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
 }
 
-static char *skel_getwd(vfs_handle_struct *handle)
+static struct smb_filename *skel_getwd(vfs_handle_struct *handle,
+					TALLOC_CTX *ctx)
 {
-	return SMB_VFS_NEXT_GETWD(handle);
+	return SMB_VFS_NEXT_GETWD(handle, ctx);
 }
 
 static int skel_ntimes(vfs_handle_struct *handle,
@@ -600,9 +602,11 @@ static int skel_mknod(vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev);
 }
 
-static char *skel_realpath(vfs_handle_struct *handle, const char *path)
+static struct smb_filename *skel_realpath(vfs_handle_struct *handle,
+			TALLOC_CTX *ctx,
+			const struct smb_filename *smb_fname)
 {
-	return SMB_VFS_NEXT_REALPATH(handle, path);
+	return SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname);
 }
 
 static int skel_chflags(vfs_handle_struct *handle,
@@ -735,9 +739,9 @@ static int skel_get_real_filename(struct vfs_handle_struct *handle,
 }
 
 static const char *skel_connectpath(struct vfs_handle_struct *handle,
-				    const char *filename)
+				const struct smb_filename *smb_fname)
 {
-	return SMB_VFS_NEXT_CONNECTPATH(handle, filename);
+	return SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
 }
 
 static NTSTATUS skel_brl_lock_windows(struct vfs_handle_struct *handle,
diff --git a/lib/util/memcache.c b/lib/util/memcache.c
index 9e9a208..acd663c 100644
--- a/lib/util/memcache.c
+++ b/lib/util/memcache.c
@@ -54,6 +54,7 @@ static bool memcache_is_talloc(enum memcache_number n)
 	case PDB_GETPWSID_CACHE:
 	case SINGLETON_CACHE_TALLOC:
 	case SHARE_MODE_LOCK_CACHE:
+	case GETWD_CACHE:
 		result = true;
 		break;
 	default:
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index db555f2..6a3f6c9 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -228,6 +228,16 @@
 		to const struct smb_filename * */
 /* Version 37 - Change symlink from const char *
 		to const struct smb_filename * */
+/* Version 37 - Change chdir from const char *
+		to const struct smb_filename * */
+/* Version 37 - Change getwd from char *
+		to const struct smb_filename * */
+/* Version 37 - Change conn->cwd from char *
+		to struct smb_filename * */
+/* Version 37 - Change realpath from char *
+		to struct smb_filename * */
+/* Version 37 - Change connectpath from char *
+		to struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -417,7 +427,7 @@ typedef struct connection_struct {
 	enum timestamp_set_resolution ts_res;
 	char *connectpath;
 	char *origpath;
-	char *cwd; /* Working directory. */
+	struct smb_filename *cwd_fname; /* Working directory. */
 
 	struct vfs_handle_struct *vfs_handles;		/* for the new plugins */
 
@@ -731,8 +741,10 @@ struct vfs_fn_pointers {
 			const struct smb_filename *smb_fname,
 			uid_t uid,
 			gid_t gid);
-	int (*chdir_fn)(struct vfs_handle_struct *handle, const char *path);
-	char *(*getwd_fn)(struct vfs_handle_struct *handle);
+	int (*chdir_fn)(struct vfs_handle_struct *handle,
+			 const struct smb_filename *smb_fname);
+	struct smb_filename *(*getwd_fn)(struct vfs_handle_struct *handle,
+				TALLOC_CTX *mem_ctx);
 	int (*ntimes_fn)(struct vfs_handle_struct *handle,
 			 const struct smb_filename *smb_fname,
 			 struct smb_file_time *ft);
@@ -761,7 +773,9 @@ struct vfs_fn_pointers {
 				const struct smb_filename *smb_fname,
 				mode_t mode,
 				SMB_DEV_T dev);
-	char *(*realpath_fn)(struct vfs_handle_struct *handle, const char *path);
+	struct smb_filename *(*realpath_fn)(struct vfs_handle_struct *handle,
+				TALLOC_CTX *ctx,
+				const struct smb_filename *smb_fname);
 	int (*chflags_fn)(struct vfs_handle_struct *handle,
 				const struct smb_filename *smb_fname,
 				unsigned int flags);
@@ -818,7 +832,7 @@ struct vfs_fn_pointers {
 				    char **found_name);
 
 	const char *(*connectpath_fn)(struct vfs_handle_struct *handle,
-				      const char *filename);
+				      const struct smb_filename *smb_fname);
 
 	NTSTATUS (*brl_lock_windows_fn)(struct vfs_handle_struct *handle,
 					struct byte_range_lock *br_lck,
@@ -1232,8 +1246,10 @@ int smb_vfs_call_lchown(struct vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			uid_t uid,
 			gid_t gid);
-int smb_vfs_call_chdir(struct vfs_handle_struct *handle, const char *path);
-char *smb_vfs_call_getwd(struct vfs_handle_struct *handle);
+int smb_vfs_call_chdir(struct vfs_handle_struct *handle,
+			const struct smb_filename *smb_fname);
+struct smb_filename *smb_vfs_call_getwd(struct vfs_handle_struct *handle,
+				TALLOC_CTX *ctx);
 int smb_vfs_call_ntimes(struct vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			struct smb_file_time *ft);
@@ -1269,7 +1285,9 @@ int smb_vfs_call_mknod(struct vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			mode_t mode,
 			SMB_DEV_T dev);
-char *smb_vfs_call_realpath(struct vfs_handle_struct *handle, const char *path);
+struct smb_filename *smb_vfs_call_realpath(struct vfs_handle_struct *handle,
+			TALLOC_CTX *ctx,
+			const struct smb_filename *smb_fname);
 int smb_vfs_call_chflags(struct vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			unsigned int flags);
@@ -1285,7 +1303,7 @@ int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
 				   const char *path, const char *name,
 				   TALLOC_CTX *mem_ctx, char **found_name);
 const char *smb_vfs_call_connectpath(struct vfs_handle_struct *handle,
-				     const char *filename);
+				     const struct smb_filename *smb_fname);
 NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
 				       struct byte_range_lock *br_lck,
 				       struct lock_struct *plock,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 77646b4..4365f15 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -266,15 +266,15 @@
 #define SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid) \
 	smb_vfs_call_lchown((handle)->next, (smb_fname), (uid), (gid))
 
-#define SMB_VFS_CHDIR(conn, path) \
-	smb_vfs_call_chdir((conn)->vfs_handles, (path))
-#define SMB_VFS_NEXT_CHDIR(handle, path) \
-	smb_vfs_call_chdir((handle)->next, (path))
+#define SMB_VFS_CHDIR(conn, smb_fname) \
+	smb_vfs_call_chdir((conn)->vfs_handles, (smb_fname))
+#define SMB_VFS_NEXT_CHDIR(handle, smb_fname) \
+	smb_vfs_call_chdir((handle)->next, (smb_fname))
 
-#define SMB_VFS_GETWD(conn) \
-	smb_vfs_call_getwd((conn)->vfs_handles)
-#define SMB_VFS_NEXT_GETWD(handle) \
-	smb_vfs_call_getwd((handle)->next)
+#define SMB_VFS_GETWD(conn, ctx) \
+	smb_vfs_call_getwd((conn)->vfs_handles, (ctx))
+#define SMB_VFS_NEXT_GETWD(handle, ctx) \
+	smb_vfs_call_getwd((handle)->next, (ctx))
 
 #define SMB_VFS_NTIMES(conn, path, ts) \
 	smb_vfs_call_ntimes((conn)->vfs_handles, (path), (ts))
@@ -331,10 +331,10 @@
 #define SMB_VFS_NEXT_MKNOD(handle, smb_fname, mode, dev) \
 	smb_vfs_call_mknod((handle)->next, (smb_fname), (mode), (dev))
 
-#define SMB_VFS_REALPATH(conn, path) \
-	smb_vfs_call_realpath((conn)->vfs_handles, (path))
-#define SMB_VFS_NEXT_REALPATH(handle, path) \
-	smb_vfs_call_realpath((handle)->next, (path))
+#define SMB_VFS_REALPATH(conn, ctx, smb_fname) \
+	smb_vfs_call_realpath((conn)->vfs_handles, (ctx), (smb_fname))
+#define SMB_VFS_NEXT_REALPATH(handle, ctx, smb_fname) \
+	smb_vfs_call_realpath((handle)->next, (ctx), (smb_fname))
 
 #define SMB_VFS_CHFLAGS(conn, smb_fname, flags) \
 	smb_vfs_call_chflags((conn)->vfs_handles, (smb_fname), (flags))
@@ -356,10 +356,10 @@
 #define SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, found_name) \
 	smb_vfs_call_get_real_filename((handle)->next, (path), (name), (mem_ctx), (found_name))
 
-#define SMB_VFS_CONNECTPATH(conn, fname) \
-	smb_vfs_call_connectpath((conn)->vfs_handles, (fname))
-#define SMB_VFS_NEXT_CONNECTPATH(conn, fname) \
-	smb_vfs_call_connectpath((conn)->next, (fname))
+#define SMB_VFS_CONNECTPATH(conn, smb_fname) \
+	smb_vfs_call_connectpath((conn)->vfs_handles, (smb_fname))
+#define SMB_VFS_NEXT_CONNECTPATH(conn, smb_fname) \
+	smb_vfs_call_connectpath((conn)->next, (smb_fname))
 
 #define SMB_VFS_BRL_LOCK_WINDOWS(conn, br_lck, plock, blocking_lock) \
 	smb_vfs_call_brl_lock_windows((conn)->vfs_handles, (br_lck), (plock), (blocking_lock))
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index bd1d755..6abf1e3 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -1288,7 +1288,7 @@ static NTSTATUS fset_nt_acl_common(vfs_handle_struct *handle, files_struct *fsp,
 }
 
 static int acl_common_remove_object(vfs_handle_struct *handle,
-					const char *path,
+					const struct smb_filename *smb_fname,
 					bool is_directory)
 {
 	connection_struct *conn = handle->conn;
@@ -1297,17 +1297,18 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 	int ret = 0;
 	char *parent_dir = NULL;
 	const char *final_component = NULL;
-	struct smb_filename local_fname;
+	struct smb_filename local_fname = {0};
+	struct smb_filename parent_dir_fname = {0};
 	int saved_errno = 0;
-	char *saved_dir = NULL;
+	struct smb_filename *saved_dir_fname = NULL;
 
-	saved_dir = vfs_GetWd(talloc_tos(),conn);
-	if (!saved_dir) {
+	saved_dir_fname = vfs_GetWd(talloc_tos(),conn);
+	if (saved_dir_fname == NULL) {
 		saved_errno = errno;
 		goto out;
 	}
 
-	if (!parent_dirname(talloc_tos(), path,
+	if (!parent_dirname(talloc_tos(), smb_fname->base_name,
 			&parent_dir, &final_component)) {
 		saved_errno = ENOMEM;
 		goto out;
@@ -1316,14 +1317,15 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 	DBG_DEBUG("removing %s %s/%s\n", is_directory ? "directory" : "file",
 		  parent_dir, final_component);
 
+	parent_dir_fname = (struct smb_filename) { .base_name = parent_dir };
+
  	/* cd into the parent dir to pin it. */
-	ret = vfs_ChDir(conn, parent_dir);
+	ret = vfs_ChDir(conn, &parent_dir_fname);
 	if (ret == -1) {
 		saved_errno = errno;
 		goto out;
 	}
 
-	ZERO_STRUCT(local_fname);
 	local_fname.base_name = discard_const_p(char, final_component);
 
 	/* Must use lstat here. */
@@ -1370,8 +1372,9 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 
 	TALLOC_FREE(parent_dir);
 
-	if (saved_dir) {
-		vfs_ChDir(conn, saved_dir);
+	if (saved_dir_fname) {
+		vfs_ChDir(conn, saved_dir_fname);
+		TALLOC_FREE(saved_dir_fname);
 	}
 	if (saved_errno) {
 		errno = saved_errno;
@@ -1393,7 +1396,7 @@ static int rmdir_acl_common(struct vfs_handle_struct *handle,
 		/* Failed due to access denied,
 		   see if we need to root override. */
 		return acl_common_remove_object(handle,
-						smb_fname->base_name,
+						smb_fname,
 						true);
 	}
 
@@ -1422,7 +1425,7 @@ static int unlink_acl_common(struct vfs_handle_struct *handle,
 			return -1;
 		}
 		return acl_common_remove_object(handle,
-					smb_fname->base_name,
+					smb_fname,
 					false);
 	}
 
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index c07a059..e4d30cb 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -436,16 +436,40 @@ static int cap_lchown(vfs_handle_struct *handle,
 	return ret;
 }
 
-static int cap_chdir(vfs_handle_struct *handle, const char *path)
+static int cap_chdir(vfs_handle_struct *handle,
+			const struct smb_filename *smb_fname)
 {
-	char *cappath = capencode(talloc_tos(), path);
+	struct smb_filename *cap_smb_fname = NULL;
+	char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+	int ret;
+	int saved_errno = 0;
 
 	if (!cappath) {
 		errno = ENOMEM;
 		return -1;
 	}
-	DEBUG(3,("cap: cap_chdir for %s\n", path));
-	return SMB_VFS_NEXT_CHDIR(handle, cappath);
+	DEBUG(3,("cap: cap_chdir for %s\n", smb_fname->base_name));
+
+	cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+					cappath,
+					NULL,
+					NULL,
+					smb_fname->flags);
+	if (cap_smb_fname == NULL) {
+		TALLOC_FREE(cappath);
+		errno = ENOMEM;
+		return -1;
+	}
+	ret = SMB_VFS_NEXT_CHDIR(handle, cap_smb_fname);
+	if (ret == -1) {
+		saved_errno = errno;
+	}
+	TALLOC_FREE(cappath);
+	TALLOC_FREE(cap_smb_fname);
+	if (saved_errno != 0) {
+		errno = saved_errno;
+	}
+	return ret;
 }
 
 static int cap_ntimes(vfs_handle_struct *handle,
@@ -643,16 +667,40 @@ static int cap_mknod(vfs_handle_struct *handle,
 	return ret;
 }
 
-static char *cap_realpath(vfs_handle_struct *handle, const char *path)
+static struct smb_filename *cap_realpath(vfs_handle_struct *handle,
+			TALLOC_CTX *ctx,
+			const struct smb_filename *smb_fname)
 {
         /* monyo need capencode'ed and capdecode'ed? */
-	char *cappath = capencode(talloc_tos(), path);
+	struct smb_filename *cap_smb_fname = NULL;
+	struct smb_filename *return_fname = NULL;
+	char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+	int saved_errno = 0;
 
 	if (!cappath) {
 		errno = ENOMEM;
 		return NULL;
 	}
-	return SMB_VFS_NEXT_REALPATH(handle, cappath);
+	cap_smb_fname = synthetic_smb_fname(ctx,
+					cappath,
+					NULL,
+					NULL,
+					smb_fname->flags);
+	if (cap_smb_fname == NULL) {
+		TALLOC_FREE(cappath);
+		errno = ENOMEM;
+		return NULL;
+	}
+	return_fname = SMB_VFS_NEXT_REALPATH(handle, ctx, cap_smb_fname);
+	if (return_fname == NULL) {
+		saved_errno = errno;
+	}
+	TALLOC_FREE(cappath);
+	TALLOC_FREE(cap_smb_fname);
+	if (saved_errno != 0) {
+		errno = saved_errno;
+	}
+	return return_fname;
 }
 
 static int cap_chmod_acl(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index ed16e43..6adf441 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -991,21 +991,35 @@ static int catia_mkdir(vfs_handle_struct *handle,
 }
 
 static int catia_chdir(vfs_handle_struct *handle,
-		       const char *path)
+			const struct smb_filename *smb_fname)
 {
 	char *name = NULL;
+	struct smb_filename *catia_smb_fname = NULL;
 	NTSTATUS status;
 	int ret;
 
-	status = catia_string_replace_allocate(handle->conn, path,
-					&name, vfs_translate_to_unix);
+	status = catia_string_replace_allocate(handle->conn,
+					smb_fname->base_name,
+					&name,
+					vfs_translate_to_unix);
 	if (!NT_STATUS_IS_OK(status)) {
 		errno = map_errno_from_nt_status(status);
 		return -1;
 	}
 
-	ret = SMB_VFS_NEXT_CHDIR(handle, name);
+	catia_smb_fname = synthetic_smb_fname(talloc_tos(),
+					name,
+					NULL,
+					NULL,
+					smb_fname->flags);
+	if (catia_smb_fname == NULL) {
+		TALLOC_FREE(name);
+		errno = ENOMEM;
+		return -1;
+	}
+	ret = SMB_VFS_NEXT_CHDIR(handle, catia_smb_fname);
 	TALLOC_FREE(name);
+	TALLOC_FREE(catia_smb_fname);
 
 	return ret;
 }
@@ -1041,24 +1055,38 @@ static int catia_ntimes(vfs_handle_struct *handle,
 	return ret;
 }
 
-static char *
-catia_realpath(vfs_handle_struct *handle, const char *path)
+static struct smb_filename *
+catia_realpath(vfs_handle_struct *handle,
+		TALLOC_CTX *ctx,
+		const struct smb_filename *smb_fname)
 {
 	char *mapped_name = NULL;
+	struct smb_filename *catia_smb_fname = NULL;
+	struct smb_filename *return_fname = NULL;
 	NTSTATUS status;
-	char *ret = NULL;
 
-	status = catia_string_replace_allocate(handle->conn, path,
+	status = catia_string_replace_allocate(handle->conn,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list