[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-56-ge129384

Tim Prouty tprouty at samba.org
Thu Jun 25 04:17:52 GMT 2009


The branch, master has been updated
       via  e129384d7c1df664e447186673dd107e190e2894 (commit)
       via  36c10191750c845a2a7cd6cc62149b1095c0b651 (commit)
      from  b7ea2740d5b04ab312c8052ef71429f2a43007aa (commit)

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


- Log -----------------------------------------------------------------
commit e129384d7c1df664e447186673dd107e190e2894
Author: Tim Prouty <tprouty at samba.org>
Date:   Mon Jun 22 15:26:56 2009 -0700

    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.

commit 36c10191750c845a2a7cd6cc62149b1095c0b651
Author: Tim Prouty <tprouty at samba.org>
Date:   Thu Jun 18 11:38:42 2009 -0700

    s3: Convert is_visible_file to use talloc_asprintf instead of malloc

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

Summary of changes:
 examples/VFS/skel_opaque.c          |    8 +-
 examples/VFS/skel_transparent.c     |    8 +-
 source3/include/proto.h             |   21 ++-
 source3/include/vfs.h               |    6 +-
 source3/include/vfs_macros.h        |   12 +-
 source3/modules/nfs4_acls.c         |    2 +-
 source3/modules/vfs_acl_tdb.c       |   46 +++--
 source3/modules/vfs_acl_xattr.c     |   14 +-
 source3/modules/vfs_afsacl.c        |    2 +-
 source3/modules/vfs_cap.c           |   38 ++++-
 source3/modules/vfs_catia.c         |   36 +++-
 source3/modules/vfs_default.c       |   38 ++++-
 source3/modules/vfs_fake_perms.c    |   15 +-
 source3/modules/vfs_full_audit.c    |   18 +-
 source3/modules/vfs_gpfs.c          |   36 +++-
 source3/modules/vfs_hpuxacl.c       |    2 +-
 source3/modules/vfs_recycle.c       |    8 +-
 source3/modules/vfs_shadow_copy2.c  |   12 +-
 source3/modules/vfs_solarisacl.c    |    2 +-
 source3/modules/vfs_streams_depot.c |  338 +++++++++++++++++++++++------------
 source3/modules/vfs_streams_xattr.c |  160 ++++++++++-------
 source3/modules/vfs_xattr_tdb.c     |   12 +-
 source3/smbd/close.c                |   10 +-
 source3/smbd/dir.c                  |  107 ++++++++---
 source3/smbd/dosmode.c              |    4 +-
 source3/smbd/file_access.c          |  123 +++++++++----
 source3/smbd/fileio.c               |    2 +-
 source3/smbd/filename.c             |  111 +++++++++---
 source3/smbd/msdfs.c                |    2 +-
 source3/smbd/notify.c               |   32 +++--
 source3/smbd/open.c                 |  126 ++++++++------
 source3/smbd/posix_acls.c           |   13 +-
 source3/smbd/reply.c                |  133 ++++++--------
 source3/smbd/service.c              |   18 ++-
 source3/smbd/statcache.c            |    2 +-
 source3/smbd/trans2.c               |  164 +++++++++++------
 source3/smbd/vfs.c                  |  110 ++++--------
 source3/torture/cmd_vfs.c           |   26 +++-
 38 files changed, 1151 insertions(+), 666 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index d1000f1..ee8a3d8 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -179,9 +179,9 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 	return vfswrap_fsync(NULL, fsp);
 }
 
-static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
+static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	return vfswrap_stat(NULL,  fname, sbuf);
+	return vfswrap_stat(NULL, smb_fname);
 }
 
 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
@@ -189,9 +189,9 @@ static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_S
 	return vfswrap_fstat(NULL, fsp, sbuf);
 }
 
-static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
+static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	return vfswrap_lstat(NULL,  path, sbuf);
+	return vfswrap_lstat(NULL, smb_fname);
 }
 
 static int skel_unlink(vfs_handle_struct *handle,  const char *path)
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 101951b..10b10b8 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -172,9 +172,9 @@ static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
 	return SMB_VFS_NEXT_FSYNC(handle, fsp);
 }
 
-static int skel_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
+static int skel_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	return SMB_VFS_NEXT_STAT(handle, fname, sbuf);
+	return SMB_VFS_NEXT_STAT(handle, smb_fname);
 }
 
 static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf)
@@ -182,9 +182,9 @@ static int skel_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_S
 	return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
 }
 
-static int skel_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf)
+static int skel_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	return SMB_VFS_NEXT_LSTAT(handle, path, sbuf);
+	return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
 }
 
 static int skel_unlink(vfs_handle_struct *handle,  const char *path)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index ffd2858..d55d6c1 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -3508,7 +3508,6 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
 
 /* The following definitions come from modules/vfs_default.c  */
 
-int vfswrap_lstat(vfs_handle_struct *handle,  const char *path, SMB_STRUCT_STAT *sbuf);
 ssize_t vfswrap_llistxattr(struct vfs_handle_struct *handle, const char *path, char *list, size_t size);
 ssize_t vfswrap_flistxattr(struct vfs_handle_struct *handle, struct files_struct *fsp, char *list, size_t size);
 NTSTATUS vfs_default_init(void);
@@ -6336,11 +6335,13 @@ NTSTATUS close_fake_file(struct smb_request *req, files_struct *fsp);
 /* The following definitions come from smbd/file_access.c  */
 
 bool can_access_file_acl(struct connection_struct *conn,
-				const char * fname,
-				uint32_t access_mask);
+			 const struct smb_filename *smb_fname,
+			 uint32_t access_mask);
 bool can_delete_file_in_directory(connection_struct *conn,
-				  const struct smb_filename *smb_fname);
-bool can_access_file_data(connection_struct *conn, const char *fname, const SMB_STRUCT_STAT *psbuf, uint32 access_mask);
+				  struct smb_filename *smb_fname);
+bool can_access_file_data(connection_struct *conn,
+			  const struct smb_filename *smb_fname,
+			  uint32 access_mask);
 bool can_write_to_file(connection_struct *conn, const char *fname, const SMB_STRUCT_STAT *psbuf);
 bool directory_has_default_acl(connection_struct *conn, const char *fname);
 
@@ -6366,12 +6367,16 @@ NTSTATUS get_full_smb_filename(TALLOC_CTX *ctx, const struct smb_filename *smb_f
 			      char **full_name);
 NTSTATUS create_synthetic_smb_fname(TALLOC_CTX *ctx, const char *base_name,
 				    const char *stream_name,
-				    SMB_STRUCT_STAT *psbuf,
+				    const SMB_STRUCT_STAT *psbuf,
 				    struct smb_filename **smb_fname_out);
 NTSTATUS create_synthetic_smb_fname_split(TALLOC_CTX *ctx,
 					  const char *fname,
-					  SMB_STRUCT_STAT *psbuf,
+					  const SMB_STRUCT_STAT *psbuf,
 					  struct smb_filename **smb_fname_out);
+int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
+		       SMB_STRUCT_STAT *psbuf);
+int vfs_lstat_smb_fname(struct connection_struct *conn, const char *fname,
+			SMB_STRUCT_STAT *psbuf);
 const char *smb_fname_str_dbg(const struct smb_filename *smb_fname);
 NTSTATUS copy_smb_filename(TALLOC_CTX *ctx,
 			   const struct smb_filename *smb_fname_in,
@@ -7137,8 +7142,6 @@ void vfs_remove_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 void *vfs_memctx_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 void *vfs_fetch_fsp_extension(vfs_handle_struct *handle, files_struct *fsp);
 bool smbd_vfs_init(connection_struct *conn);
-bool vfs_directory_exist(connection_struct *conn, const char *dname, SMB_STRUCT_STAT *st);
-bool vfs_object_exist(connection_struct *conn,const char *fname,SMB_STRUCT_STAT *sbuf);
 NTSTATUS vfs_file_exist(connection_struct *conn, struct smb_filename *smb_fname);
 ssize_t vfs_read_data(files_struct *fsp, char *buf, size_t byte_count);
 ssize_t vfs_pread_data(files_struct *fsp, char *buf,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 53a4798..2a0c5ec 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -118,7 +118,7 @@
 /* Leave at 25 - not yet released. Add locking calls. -- zkirsch. */
 /* Leave at 25 - not yet released. Add strict locking calls. -- drichards. */
 /* Changed to version 26 - Plumb struct smb_filename to SMB_VFS_CREATE_FILE,
-			   SMB_VFS_OPEN. */
+			   SMB_VFS_OPEN, SMB_VFS_STAT, SMB_VFS_LSTAT. */
 
 #define SMB_VFS_INTERFACE_VERSION 26
 
@@ -359,9 +359,9 @@ struct vfs_ops {
 		ssize_t (*recvfile)(struct vfs_handle_struct *handle, int fromfd, files_struct *tofsp, SMB_OFF_T offset, size_t count);
 		int (*rename)(struct vfs_handle_struct *handle, const char *oldname, const char *newname);
 		int (*fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp);
-		int (*stat)(struct vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf);
+		int (*stat)(struct vfs_handle_struct *handle, struct smb_filename *smb_fname);
 		int (*fstat)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_STAT *sbuf);
-		int (*lstat)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf);
+		int (*lstat)(struct vfs_handle_struct *handle, struct smb_filename *smb_filename);
 		uint64_t (*get_alloc_size)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_STAT *sbuf);
 		int (*unlink)(struct vfs_handle_struct *handle, const char *path);
 		int (*chmod)(struct vfs_handle_struct *handle, const char *path, mode_t mode);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index d888361..b0a0737 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -60,9 +60,9 @@
 #define SMB_VFS_RECVFILE(fromfd, tofsp, offset, count) ((tofsp)->conn->vfs.ops.recvfile((tofsp)->conn->vfs.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_RENAME(conn, old, new) ((conn)->vfs.ops.rename((conn)->vfs.handles.rename, (old), (new)))
 #define SMB_VFS_FSYNC(fsp) ((fsp)->conn->vfs.ops.fsync((fsp)->conn->vfs.handles.fsync, (fsp)))
-#define SMB_VFS_STAT(conn, fname, sbuf) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_STAT(conn, smb_fname) ((conn)->vfs.ops.stat((conn)->vfs.handles.stat, (smb_fname)))
 #define SMB_VFS_FSTAT(fsp, sbuf) ((fsp)->conn->vfs.ops.fstat((fsp)->conn->vfs.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_LSTAT(conn, path, sbuf) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_LSTAT(conn, smb_fname) ((conn)->vfs.ops.lstat((conn)->vfs.handles.lstat, (smb_fname)))
 #define SMB_VFS_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs.ops.get_alloc_size((conn)->vfs.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_UNLINK(conn, path) ((conn)->vfs.ops.unlink((conn)->vfs.handles.unlink, (path)))
 #define SMB_VFS_CHMOD(conn, path, mode) ((conn)->vfs.ops.chmod((conn)->vfs.handles.chmod, (path), (mode)))
@@ -195,9 +195,9 @@
 #define SMB_VFS_OPAQUE_RECVFILE(fromfd, tofsp, offset, count) ((tofsp)->conn->vfs_opaque.ops.recvfile((tofsp)->conn->vfs_opaque.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_OPAQUE_RENAME(conn, old, new) ((conn)->vfs_opaque.ops.rename((conn)->vfs_opaque.handles.rename, (old), (new)))
 #define SMB_VFS_OPAQUE_FSYNC(fsp) ((fsp)->conn->vfs_opaque.ops.fsync((fsp)->conn->vfs_opaque.handles.fsync, (fsp)))
-#define SMB_VFS_OPAQUE_STAT(conn, fname, sbuf) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_OPAQUE_STAT(conn, smb_fname) ((conn)->vfs_opaque.ops.stat((conn)->vfs_opaque.handles.stat, (smb_fname)))
 #define SMB_VFS_OPAQUE_FSTAT(fsp, sbuf) ((fsp)->conn->vfs_opaque.ops.fstat((fsp)->conn->vfs_opaque.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_OPAQUE_LSTAT(conn, path, sbuf) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_OPAQUE_LSTAT(conn, smb_fname) ((conn)->vfs_opaque.ops.lstat((conn)->vfs_opaque.handles.lstat, (smb_fname)))
 #define SMB_VFS_OPAQUE_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_opaque.ops.get_alloc_size((conn)->vfs_opaque.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_OPAQUE_UNLINK(conn, path) ((conn)->vfs_opaque.ops.unlink((conn)->vfs_opaque.handles.unlink, (path)))
 #define SMB_VFS_OPAQUE_CHMOD(conn, path, mode) ((conn)->vfs_opaque.ops.chmod((conn)->vfs_opaque.handles.chmod, (path), (mode)))
@@ -331,9 +331,9 @@
 #define SMB_VFS_NEXT_RECVFILE(handle, fromfd, tofsp, offset, count) ((handle)->vfs_next.ops.recvfile((handle)->vfs_next.handles.recvfile, (fromfd), (tofsp), (offset), (count)))
 #define SMB_VFS_NEXT_RENAME(handle, old, new) ((handle)->vfs_next.ops.rename((handle)->vfs_next.handles.rename, (old), (new)))
 #define SMB_VFS_NEXT_FSYNC(handle, fsp) ((handle)->vfs_next.ops.fsync((handle)->vfs_next.handles.fsync, (fsp)))
-#define SMB_VFS_NEXT_STAT(handle, fname, sbuf) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (fname), (sbuf)))
+#define SMB_VFS_NEXT_STAT(handle, smb_fname) ((handle)->vfs_next.ops.stat((handle)->vfs_next.handles.stat, (smb_fname)))
 #define SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) ((handle)->vfs_next.ops.fstat((handle)->vfs_next.handles.fstat, (fsp), (sbuf)))
-#define SMB_VFS_NEXT_LSTAT(handle, path, sbuf) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (path), (sbuf)))
+#define SMB_VFS_NEXT_LSTAT(handle, smb_fname) ((handle)->vfs_next.ops.lstat((handle)->vfs_next.handles.lstat, (smb_fname)))
 #define SMB_VFS_NEXT_GET_ALLOC_SIZE(conn, fsp, sbuf) ((conn)->vfs_next.ops.get_alloc_size((conn)->vfs_next.handles.get_alloc_size, (fsp), (sbuf)))
 #define SMB_VFS_NEXT_UNLINK(handle, path) ((handle)->vfs_next.ops.unlink((handle)->vfs_next.handles.unlink, (path)))
 #define SMB_VFS_NEXT_CHMOD(handle, path, mode) ((handle)->vfs_next.ops.chmod((handle)->vfs_next.handles.chmod, (path), (mode)))
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 10a3733..320f9da 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -168,7 +168,7 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn,
 	memset(psbuf, 0, sizeof(SMB_STRUCT_STAT));
 
 	/* Get the stat struct for the owner info. */
-	if (SMB_VFS_STAT(conn, filename, psbuf) != 0)
+	if (vfs_stat_smb_fname(conn, filename, psbuf) != 0)
 	{
 		DEBUG(8, ("SMB_VFS_STAT failed with error %s\n",
 			strerror(errno)));
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index e0a5b14..9f0b0b3 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -196,9 +196,9 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
 		ret = SMB_VFS_FSTAT(fsp, &sbuf);
 	} else {
 		if (fsp && fsp->posix_open) {
-			ret = SMB_VFS_LSTAT(handle->conn, name, &sbuf);
+			ret = vfs_lstat_smb_fname(handle->conn, name, &sbuf);
 		} else {
-			ret = SMB_VFS_STAT(handle->conn, name, &sbuf);
+			ret = vfs_stat_smb_fname(handle->conn, name, &sbuf);
 		}
 	}
 
@@ -288,9 +288,11 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
 		ret = SMB_VFS_FSTAT(fsp, &sbuf);
 	} else {
 		if (fsp->posix_open) {
-			ret = SMB_VFS_LSTAT(handle->conn, fsp->fsp_name, &sbuf);
+			ret = vfs_lstat_smb_fname(handle->conn, fsp->fsp_name,
+						  &sbuf);
 		} else {
-			ret = SMB_VFS_STAT(handle->conn, fsp->fsp_name, &sbuf);
+			ret = vfs_stat_smb_fname(handle->conn, fsp->fsp_name,
+						 &sbuf);
 		}
 	}
 
@@ -338,9 +340,9 @@ static NTSTATUS store_acl_blob_pathname(vfs_handle_struct *handle,
 		return NT_STATUS_INTERNAL_DB_CORRUPTION);
 
 	if (lp_posix_pathnames()) {
-		ret = SMB_VFS_LSTAT(handle->conn, fname, &sbuf);
+		ret = vfs_lstat_smb_fname(handle->conn, fname, &sbuf);
 	} else {
-		ret = SMB_VFS_STAT(handle->conn, fname, &sbuf);
+		ret = vfs_stat_smb_fname(handle->conn, fname, &sbuf);
 	}
 
 	if (ret == -1) {
@@ -514,9 +516,11 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
 			ret = SMB_VFS_FSTAT(fsp, &sbuf);
 		} else {
 			if (fsp && fsp->posix_open) {
-				ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf);
+				ret = vfs_lstat_smb_fname(handle->conn,fname,
+							  &sbuf);
 			} else {
-				ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+				ret = vfs_stat_smb_fname(handle->conn,fname,
+							 &sbuf);
 			}
 		}
 		if (ret == -1) {
@@ -621,9 +625,9 @@ static int unlink_acl_tdb(vfs_handle_struct *handle, const char *path)
 	SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
 	if (lp_posix_pathnames()) {
-		ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+		ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf);
 	} else {
-		ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+		ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
 	}
 
 	if (ret == -1) {
@@ -670,9 +674,9 @@ static int rmdir_acl_tdb(vfs_handle_struct *handle, const char *path)
 	SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
 	if (lp_posix_pathnames()) {
-		ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+		ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf);
 	} else {
-		ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+		ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
 	}
 
 	if (ret == -1) {
@@ -774,9 +778,13 @@ static NTSTATUS fset_nt_acl_tdb(vfs_handle_struct *handle, files_struct *fsp,
 		}
 		if (fsp->is_directory || fsp->fh->fd == -1) {
 			if (fsp->posix_open) {
-				ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+				ret = vfs_lstat_smb_fname(fsp->conn,
+							  fsp->fsp_name,
+							  &sbuf);
 			} else {
-				ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+				ret = vfs_stat_smb_fname(fsp->conn,
+							 fsp->fsp_name,
+							 &sbuf);
 			}
 		} else {
 			ret = SMB_VFS_FSTAT(fsp, &sbuf);
@@ -867,9 +875,9 @@ static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
 	SMB_VFS_HANDLE_GET_DATA(handle, db, struct db_context, return -1);
 
 	if (lp_posix_pathnames()) {
-		ret = SMB_VFS_LSTAT(handle->conn, path, &sbuf);
+		ret = vfs_lstat_smb_fname(handle->conn, path, &sbuf);
 	} else {
-		ret = SMB_VFS_STAT(handle->conn, path, &sbuf);
+		ret = vfs_stat_smb_fname(handle->conn, path, &sbuf);
 	}
 
 	if (ret == -1) {
@@ -904,9 +912,11 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
 
 	if (fsp->is_directory || fsp->fh->fd == -1) {
 		if (fsp->posix_open) {
-			ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+			ret = vfs_lstat_smb_fname(fsp->conn,fsp->fsp_name,
+						  &sbuf);
 		} else {
-			ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+			ret = vfs_stat_smb_fname(fsp->conn,fsp->fsp_name,
+						 &sbuf);
 		}
 	} else {
 		ret = SMB_VFS_FSTAT(fsp, &sbuf);
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index efcc877..66bf21c 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -382,9 +382,11 @@ static NTSTATUS inherit_new_acl(vfs_handle_struct *handle,
 			ret = SMB_VFS_FSTAT(fsp, &sbuf);
 		} else {
 			if (fsp && fsp->posix_open) {
-				ret = SMB_VFS_LSTAT(handle->conn,fname, &sbuf);
+				ret = vfs_lstat_smb_fname(handle->conn, fname,
+							  &sbuf);
 			} else {
-				ret = SMB_VFS_STAT(handle->conn,fname, &sbuf);
+				ret = vfs_stat_smb_fname(handle->conn, fname,
+							 &sbuf);
 			}
 		}
 		if (ret == -1) {
@@ -574,9 +576,13 @@ static NTSTATUS fset_nt_acl_xattr(vfs_handle_struct *handle, files_struct *fsp,
 		}
 		if (fsp->is_directory || fsp->fh->fd == -1) {
 			if (fsp->posix_open) {
-				ret = SMB_VFS_LSTAT(fsp->conn,fsp->fsp_name, &sbuf);
+				ret = vfs_lstat_smb_fname(fsp->conn,
+							  fsp->fsp_name,
+							  &sbuf);
 			} else {
-				ret = SMB_VFS_STAT(fsp->conn,fsp->fsp_name, &sbuf);
+				ret = vfs_stat_smb_fname(fsp->conn,
+							 fsp->fsp_name,
+							 &sbuf);
 			}
 		} else {
 			ret = SMB_VFS_FSTAT(fsp, &sbuf);
diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c
index e537f01..55371c6 100644
--- a/source3/modules/vfs_afsacl.c
+++ b/source3/modules/vfs_afsacl.c
@@ -662,7 +662,7 @@ static size_t afs_to_nt_acl(struct afs_acl *afs_acl,
 	SMB_STRUCT_STAT sbuf;
 
 	/* Get the stat struct for the owner info. */
-	if(SMB_VFS_STAT(conn, name, &sbuf) != 0) {
+	if(vfs_stat_smb_fname(conn, name, &sbuf) != 0) {
 		return 0;
 	}
 
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 4525fa1..12a8875 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -144,26 +144,52 @@ static int cap_rename(vfs_handle_struct *handle, const char *oldname, const char
 	return SMB_VFS_NEXT_RENAME(handle, capold, capnew);
 }
 
-static int cap_stat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
+static int cap_stat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	char *cappath = capencode(talloc_tos(), path);
+	char *cappath;
+	char *tmp_base_name = NULL;
+	int ret;
+
+	cappath = capencode(talloc_tos(), smb_fname->base_name);
 
 	if (!cappath) {
 		errno = ENOMEM;
 		return -1;
 	}
-	return SMB_VFS_NEXT_STAT(handle, cappath, sbuf);
+
+	tmp_base_name = smb_fname->base_name;
+	smb_fname->base_name = cappath;
+
+	ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+
+	smb_fname->base_name = tmp_base_name;
+	TALLOC_FREE(cappath);
+
+	return ret;
 }
 
-static int cap_lstat(vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf)
+static int cap_lstat(vfs_handle_struct *handle, struct smb_filename *smb_fname)
 {
-	char *cappath = capencode(talloc_tos(), path);
+	char *cappath;
+	char *tmp_base_name = NULL;
+	int ret;
+
+	cappath = capencode(talloc_tos(), smb_fname->base_name);
 
 	if (!cappath) {
 		errno = ENOMEM;
 		return -1;
 	}
-	return SMB_VFS_NEXT_LSTAT(handle, cappath, sbuf);
+
+	tmp_base_name = smb_fname->base_name;
+	smb_fname->base_name = cappath;
+
+	ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
+
+	smb_fname->base_name = tmp_base_name;
+	TALLOC_FREE(cappath);
+
+	return ret;
 }
 
 static int cap_unlink(vfs_handle_struct *handle, const char *path)
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index 8d1c87a..c8c340d 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -177,27 +177,51 @@ static int catia_rename(vfs_handle_struct *handle,
 }
 
 static int catia_stat(vfs_handle_struct *handle,
-		      const char *fname, SMB_STRUCT_STAT *sbuf)
+		      struct smb_filename *smb_fname)
 {
-	char *name = to_unix(talloc_tos(), fname);
+	char *name;
+	char *tmp_base_name;
+	int ret;
 
+	name = to_unix(talloc_tos(), smb_fname->base_name);
 	if (!name) {
 		errno = ENOMEM;
 		return -1;
 	}
-        return SMB_VFS_NEXT_STAT(handle, name, sbuf);
+
+	tmp_base_name = smb_fname->base_name;
+	smb_fname->base_name = name;
+
+	ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+
+	smb_fname->base_name = tmp_base_name;
+	TALLOC_FREE(name);
+
+	return ret;
 }
 
 static int catia_lstat(vfs_handle_struct *handle,
-		       const char *path, SMB_STRUCT_STAT *sbuf)
+		       struct smb_filename *smb_fname)
 {
-	char *name = to_unix(talloc_tos(), path);
+	char *name;
+	char *tmp_base_name;
+	int ret;
 
+	name = to_unix(talloc_tos(), smb_fname->base_name);
 	if (!name) {
 		errno = ENOMEM;
 		return -1;
 	}
-        return SMB_VFS_NEXT_LSTAT(handle, name, sbuf);
+
+	tmp_base_name = smb_fname->base_name;
+	smb_fname->base_name = name;
+
+	ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
+
+	smb_fname->base_name = tmp_base_name;
+	TALLOC_FREE(name);
+
+	return ret;
 }
 
 static int catia_unlink(vfs_handle_struct *handle, const char *path)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 0e7ba05..cd792ab 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -549,12 +549,26 @@ static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
 #endif
 }
 
-static int vfswrap_stat(vfs_handle_struct *handle,  const char *fname, SMB_STRUCT_STAT *sbuf)
+static int vfswrap_stat(vfs_handle_struct *handle,
+			struct smb_filename *smb_fname)
 {
 	int result;
+	NTSTATUS status;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list