[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Dec 14 07:44:09 UTC 2015


The branch, master has been updated
       via  b36c621 s3: smbd: When requesting posix open in open_file_ntcreate() we need to set all posix flags.
       via  07c4967 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  dea2add s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  0db1ad9 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  82fa4ec s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  cad35c5 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  c19eaf3 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  cc13120 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  a1deced s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
       via  c808a63 s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
      from  7fb3d28 ctdb-client: Only get capabilities from active nodes

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


- Log -----------------------------------------------------------------
commit b36c6214f02d99c758395cb93e67ca2eda8b83a7
Author: Ralph Boehme <rb at sernet.de>
Date:   Sun Dec 13 09:52:50 2015 -0800

    s3: smbd: When requesting posix open in open_file_ntcreate() we need to set all posix flags.
    
    Fixes POSIX rename problem introduced in d698cec1c7e700e57cab46d33df0dde13303b318
    
    Signed-off-by: Ralph Boehme <rb at sernet.de>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Dec 14 02:03:12 CET 2015 on sn-devel-104

commit 07c4967d6ced0a7c7f6ebb6448d8c5cc7df0a0ce
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:55:10 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Remove lp_posix_pathnames() out of ms_has_wild().
    
    NB. The usage of ms_has_wild() inside set_namearray()
    should *never* have been looking at lp_posix_pathnames()
    anyway, as this is a config option that needs to look
    at wildcards. This was probably an old (but never
    triggered) bug.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit dea2addab1c04860a27e1e0a2de04d51c89541da
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:53:30 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fix smbd_smb2_query_directory_send().
    
    No SMB2 client uses unix extensions yet, but this is a placeholder
    for when we move the POSIX pathnames bit into the SMB2 request
    when moving to handle based code.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 0db1ad97f8f9540e45813c3f4140c5f51f65d3a2
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:51:58 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fixup reply_search().
    
    Don't think any client makes this call with POSIX extensions
    on, but this keeps the same old behavior.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 82fa4ecec5be82924295febbaecc3c5677ef67ec
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:49:44 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fix open_file().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit cad35c5183c22faa1d88f5dbe2f522999a25962e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:45:37 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fixup reply_ntrename().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit c19eaf3e25b43c4168293b0bffd5a1116e3a8952
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:41:38 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fixup unix_convert().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit cc13120a4c37c6a4c4bce728dd9ff7ef8a6a251e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:38:49 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fixup check_parent_exists().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit a1deced2a4f5fcfa442b10e07b0644e23fd8404a
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:36:33 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Prepare to remove lp_posix_pathnames() out of ms_has_wild().
    Check before calls to ms_has_wild().
    
    Fix determine_path_error().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit c808a6370058c7d94d088fa39e85480b4e50168c
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Dec 11 14:33:22 2015 -0800

    s3: smbd: Moving lp_posix_pathnames() out of the lower-level code.
    
    Ensure we set posix_pathnames early.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 source3/lib/util.c                  |  5 ----
 source3/smbd/filename.c             | 46 +++++++++++++++++++++++++------------
 source3/smbd/nttrans.c              |  2 +-
 source3/smbd/open.c                 |  5 +++-
 source3/smbd/reply.c                |  4 +++-
 source3/smbd/smb2_query_directory.c |  4 +++-
 6 files changed, 42 insertions(+), 24 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/util.c b/source3/lib/util.c
index 420fe91..1d04318 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1611,11 +1611,6 @@ bool ms_has_wild(const char *s)
 {
 	char c;
 
-	if (lp_posix_pathnames()) {
-		/* With posix pathnames no characters are wild. */
-		return False;
-	}
-
 	while ((c = *s++)) {
 		switch (c) {
 		case '*':
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index 555658d..1174b59 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -55,9 +55,11 @@ static bool mangled_equal(const char *name1,
 ****************************************************************************/
 
 static NTSTATUS determine_path_error(const char *name,
-			bool allow_wcard_last_component)
+			bool allow_wcard_last_component,
+			bool posix_pathnames)
 {
 	const char *p;
+	bool name_has_wild = false;
 
 	if (!allow_wcard_last_component) {
 		/* Error code within a pathname. */
@@ -74,7 +76,11 @@ static NTSTATUS determine_path_error(const char *name,
 
 	p = strchr(name, '/');
 
-	if (!p && (ms_has_wild(name) || ISDOT(name))) {
+	if (!posix_pathnames) {
+		name_has_wild = ms_has_wild(name);
+	}
+
+	if (!p && (name_has_wild || ISDOT(name))) {
 		/* Error code at the end of a pathname. */
 		return NT_STATUS_OBJECT_NAME_INVALID;
 	} else {
@@ -122,6 +128,7 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
 	const char *last_component = NULL;
 	NTSTATUS status;
 	int ret;
+	bool parent_fname_has_wild = false;
 
 	ZERO_STRUCT(parent_fname);
 	if (!parent_dirname(ctx, smb_fname->base_name,
@@ -130,6 +137,10 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
 		return NT_STATUS_NO_MEMORY;
 	}
 
+	if (!posix_pathnames) {
+		parent_fname_has_wild = ms_has_wild(parent_fname.base_name);
+	}
+
 	/*
 	 * If there was no parent component in
 	 * smb_fname->base_name of the parent name
@@ -137,7 +148,7 @@ static NTSTATUS check_parent_exists(TALLOC_CTX *ctx,
 	 * optimization.
 	 */
 	if ((smb_fname->base_name == last_component) ||
-			ms_has_wild(parent_fname.base_name)) {
+			parent_fname_has_wild) {
 		return NT_STATUS_OK;
 	}
 
@@ -229,7 +240,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 	char *stream = NULL;
 	bool component_was_mangled = False;
 	bool name_has_wildcard = False;
-	bool posix_pathnames = false;
+	bool posix_pathnames = (lp_posix_pathnames() ||
+				(ucf_flags & UCF_POSIX_PATHNAMES));
 	bool allow_wcard_last_component =
 	    (ucf_flags & UCF_ALWAYS_ALLOW_WCARD_LCOMP);
 	bool save_last_component = ucf_flags & UCF_SAVE_LCOMP;
@@ -299,7 +311,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 			status = NT_STATUS_OBJECT_NAME_INVALID;
 		} else {
 			status =determine_path_error(&orig_path[2],
-			    allow_wcard_last_component);
+			    allow_wcard_last_component,
+			    posix_pathnames);
 		}
 		goto err;
 	}
@@ -348,9 +361,6 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 		}
 	}
 
-	posix_pathnames = (lp_posix_pathnames() ||
-				(ucf_flags & UCF_POSIX_PATHNAMES));
-
 	/*
 	 * Strip off the stream, and add it back when we're done with the
 	 * base_name.
@@ -438,11 +448,14 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 	 * is true.
 	 */
 
-	name_has_wildcard = ms_has_wild(smb_fname->base_name);
-	if (name_has_wildcard && !allow_wcard_last_component) {
-		/* Wildcard not valid anywhere. */
-		status = NT_STATUS_OBJECT_NAME_INVALID;
-		goto fail;
+	if (!posix_pathnames) {
+		/* POSIX pathnames have no wildcards. */
+		name_has_wildcard = ms_has_wild(smb_fname->base_name);
+		if (name_has_wildcard && !allow_wcard_last_component) {
+			/* Wildcard not valid anywhere. */
+			status = NT_STATUS_OBJECT_NAME_INVALID;
+			goto fail;
+		}
 	}
 
 	DEBUG(5,("unix_convert begin: name = %s, dirpath = %s, start = %s\n",
@@ -628,7 +641,8 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 				status = NT_STATUS_OBJECT_NAME_INVALID;
 			} else {
 				status = determine_path_error(end+1,
-						allow_wcard_last_component);
+						allow_wcard_last_component,
+						posix_pathnames);
 			}
 			goto fail;
 		}
@@ -636,7 +650,9 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 		/* The name cannot have a wildcard if it's not
 		   the last component. */
 
-		name_has_wildcard = ms_has_wild(start);
+		if (!posix_pathnames) {
+			name_has_wildcard = ms_has_wild(start);
+		}
 
 		/* Wildcards never valid within a pathname. */
 		if (name_has_wildcard && end) {
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 19c7153..098d88b 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1548,7 +1548,7 @@ void reply_ntrename(struct smb_request *req)
 		goto out;
 	}
 
-	if (ms_has_wild(oldname)) {
+	if (!lp_posix_pathnames() && ms_has_wild(oldname)) {
 		reply_nterror(req, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
 		goto out;
 	}
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 9cd415b..4053089 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -809,6 +809,7 @@ static NTSTATUS open_file(files_struct *fsp,
 			wild = smb_fname->base_name;
 		}
 		if ((local_flags & O_CREAT) && !file_existed &&
+		    !(fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) &&
 		    ms_has_wild(wild))  {
 			return NT_STATUS_OBJECT_NAME_INVALID;
 		}
@@ -2703,7 +2704,9 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 	fsp->access_mask = open_access_mask; /* We change this to the
 					      * requested access_mask after
 					      * the open is done. */
-	fsp->posix_flags |= posix_open ? FSP_POSIX_FLAGS_OPEN : 0;
+	if (posix_open) {
+		fsp->posix_flags |= FSP_POSIX_FLAGS_ALL;
+	}
 
 	if (timeval_is_zero(&request_time)) {
 		request_time = fsp->open_time;
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 3fad39b..9234978 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -1749,7 +1749,9 @@ void reply_search(struct smb_request *req)
 		 * For a 'continue' search we have no string. So
 		 * check from the initial saved string.
 		 */
-		mask_contains_wcard = ms_has_wild(mask);
+		if (!lp_posix_pathnames()) {
+			mask_contains_wcard = ms_has_wild(mask);
+		}
 		dirtype = dptr_attr(sconn, dptr_num);
 	}
 
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index 81f2e17..73f2d63 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -325,7 +325,9 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
 		dptr_CloseDir(fsp);
 	}
 
-	wcard_has_wild = ms_has_wild(in_file_name);
+	if (!lp_posix_pathnames()) {
+		wcard_has_wild = ms_has_wild(in_file_name);
+	}
 
 	/* Ensure we've canonicalized any search path if not a wildcard. */
 	if (!wcard_has_wild) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list