[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Fri Oct 21 22:31:02 MDT 2011


The branch, master has been updated
       via  f459318 Third part of fix for bug #8541 - readlink() on Linux clients fails if the symlink target is outside of the share.
       via  d1a4ee6 Second part of fix for bug #8541 - readlink() on Linux clients fails if the symlink target is outside of the share.
      from  60d9afa s4:finddcs_cldap: talloc free old memory before allocating a new netlogon struct

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


- Log -----------------------------------------------------------------
commit f4593181876f7a9ef55ceee8d1a20369197a63ba
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 21 18:35:15 2011 -0700

    Third part of fix for bug #8541 - readlink() on Linux clients fails if the symlink target is outside of the share.
    
    Missed passing ucf_flags instead of hard coded flags in findfirst call.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Sat Oct 22 06:30:16 CEST 2011 on sn-devel-104

commit d1a4ee604ffaac4c6ddf6b8939e3d42688d2c73d
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 21 17:46:12 2011 -0700

    Second part of fix for bug #8541 - readlink() on Linux clients fails if the symlink target is outside of the share.
    
    The statcache has to do lstat instead of stat when returning cached
    posix pathnames.

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

Summary of changes:
 source3/smbd/filename.c  |    2 +-
 source3/smbd/proto.h     |    1 +
 source3/smbd/statcache.c |   11 ++++++++++-
 source3/smbd/trans2.c    |    3 +--
 4 files changed, 13 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 722da31..835f3b4 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -383,7 +383,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 
 	if((!conn->case_sensitive || !(conn->fs_capabilities &
 				       FILE_CASE_SENSITIVE_SEARCH)) &&
-	    stat_cache_lookup(conn, &smb_fname->base_name, &dirpath, &start,
+	    stat_cache_lookup(conn, posix_pathnames, &smb_fname->base_name, &dirpath, &start,
 			      &smb_fname->st)) {
 		goto done;
 	}
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 9891c1e..343b0b9 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -1041,6 +1041,7 @@ void stat_cache_add( const char *full_orig_name,
 		char *translated_path,
 		bool case_sensitive);
 bool stat_cache_lookup(connection_struct *conn,
+			bool posix_paths,
 			char **pp_name,
 			char **pp_dirpath,
 			char **pp_start,
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 963b7c4..92010c2 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -150,6 +150,7 @@ void stat_cache_add( const char *full_orig_name,
  * Look through the stat cache for an entry
  *
  * @param conn    A connection struct to do the stat() with.
+ * @param posix_paths Whether to lookup using stat() or lstat()
  * @param name    The path we are attempting to cache, modified by this routine
  *                to be correct as far as the cache can tell us. We assume that
  *		  it is a talloc'ed string from top of stack, we free it if
@@ -166,6 +167,7 @@ void stat_cache_add( const char *full_orig_name,
  */
 
 bool stat_cache_lookup(connection_struct *conn,
+			bool posix_paths,
 			char **pp_name,
 			char **pp_dirpath,
 			char **pp_start,
@@ -181,6 +183,7 @@ bool stat_cache_lookup(connection_struct *conn,
 	char *name;
 	TALLOC_CTX *ctx = talloc_tos();
 	struct smb_filename smb_fname;
+	int ret;
 
 	*pp_dirpath = NULL;
 	*pp_start = *pp_name;
@@ -283,7 +286,13 @@ bool stat_cache_lookup(connection_struct *conn,
 	ZERO_STRUCT(smb_fname);
 	smb_fname.base_name = translated_path;
 
-	if (SMB_VFS_STAT(conn, &smb_fname) != 0) {
+	if (posix_paths) {
+		ret = SMB_VFS_LSTAT(conn, &smb_fname);
+	} else {
+		ret = SMB_VFS_STAT(conn, &smb_fname);
+	}
+
+	if (ret != 0) {
 		/* Discard this entry - it doesn't exist in the filesystem. */
 		memcache_delete(smbd_memcache(), STAT_CACHE,
 				data_blob_const(chk_name, strlen(chk_name)));
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 6ac95bd..f6e62ef 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2332,8 +2332,7 @@ close_if_end = %d requires_resume_key = %d level = 0x%x, max_data_bytes = %d\n",
 	ntstatus = filename_convert(ctx, conn,
 				    req->flags2 & FLAGS2_DFS_PATHNAMES,
 				    directory,
-				    (UCF_SAVE_LCOMP |
-					UCF_ALWAYS_ALLOW_WCARD_LCOMP),
+				    ucf_flags,
 				    &mask_contains_wcard,
 				    &smb_dname);
 	if (!NT_STATUS_IS_OK(ntstatus)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list