[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Wed Nov 23 15:53:05 UTC 2016


The branch, master has been updated
       via  28fbc5e s3-net: use SMB_SIGNING_DEFAULT in connect_to_service()
       via  1f91b6a param: validate value in lp_canonicalize_parameter_with_value()
       via  fa7e40b param: use early return in lp_canonicalize_parameter_with_value()
       via  21ae887 param: add lp_parameter_value_is_valid() function
       via  41cc17c net conf: fix error message
      from  c1a316b samba_dnsupdate: Raise after the error count is incremented

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


- Log -----------------------------------------------------------------
commit 28fbc5ea2e39bf23808aee5035cfc2f58b7fbcfd
Author: Günther Deschner <gd at samba.org>
Date:   Fri Nov 18 18:17:52 2016 +0100

    s3-net: use SMB_SIGNING_DEFAULT in connect_to_service()
    
    For non IPC$ connections we get NT_STATUS_REVISION_MISMATCH otherwise when using
    the connection.
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Wed Nov 23 16:52:38 CET 2016 on sn-devel-144

commit 1f91b6aa63df4c48c49dabf8b30cde33579da17f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 23 11:14:54 2016 +0100

    param: validate value in lp_canonicalize_parameter_with_value()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit fa7e40b92460c094e64cb175dfb297436fe483eb
Author: Michael Adam <obnox at samba.org>
Date:   Wed Nov 23 11:12:42 2016 +0100

    param: use early return in lp_canonicalize_parameter_with_value()
    
    This reduces the indentation and streamlines the flow.
    View with "git show -w" to see it's mostly indentation change.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 21ae8871580fbcacfb0091fb83ba328448850b4d
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Mon Nov 21 14:56:52 2016 +0100

    param: add lp_parameter_value_is_valid() function
    
    Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
    Reviewed-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 41cc17c8d174fc54754b11ff6f68b155909642f5
Author: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
Date:   Tue Nov 22 11:20:22 2016 +0100

    net conf: fix error message
    
    Signed-off-by: Ralph Wuerthner <ralph.wuerthner at de.ibm.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 source3/param/loadparm.c      | 98 +++++++++++++++++++++++++++++++++++++------
 source3/utils/net_conf_util.c |  2 +-
 source3/utils/net_util.c      |  7 +++-
 3 files changed, 92 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 3e1a15e..21073c6 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1062,6 +1062,7 @@ static bool hash_a_service(const char *name, int number);
 static void free_service_byindex(int iService);
 static void show_parameter(int parmIndex);
 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
+static bool lp_parameter_value_is_valid(const char *parm_name, const char *val);
 
 /*
  * This is a helper function for parametrical options support.  It returns a
@@ -1687,9 +1688,11 @@ bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
  Turn the value given into the inverse boolean expression when
  the synonym is an invers boolean synonym.
 
- Return true if parm_name is a valid parameter name and
- in case it is an invers boolean synonym, if the val string could
- successfully be converted to the reverse bool.
+ Return true if
+ - parm_name is a valid parameter name and
+ - val is a valid value for this parameter and
+ - in case the parameter is an inverse boolean synonym, if the val
+   string could successfully be converted to the reverse bool.
  Return false in all other cases.
 **************************************************************************/
 
@@ -1700,6 +1703,7 @@ bool lp_canonicalize_parameter_with_value(const char *parm_name,
 {
 	int num;
 	bool inverse;
+	bool ret;
 
 	if (!lp_parameter_is_valid(parm_name)) {
 		*canon_parm = NULL;
@@ -1712,19 +1716,22 @@ bool lp_canonicalize_parameter_with_value(const char *parm_name,
 		/* parametric option */
 		*canon_parm = parm_name;
 		*canon_val = val;
-	} else {
-		*canon_parm = parm_table[num].label;
-		if (inverse) {
-			if (!lp_invert_boolean(val, canon_val)) {
-				*canon_val = NULL;
-				return false;
-			}
-		} else {
-			*canon_val = val;
+		return true;
+	}
+
+	*canon_parm = parm_table[num].label;
+	if (inverse) {
+		if (!lp_invert_boolean(val, canon_val)) {
+			*canon_val = NULL;
+			return false;
 		}
+	} else {
+		*canon_val = val;
 	}
 
-	return true;
+	ret = lp_parameter_value_is_valid(*canon_parm, *canon_val);
+
+	return ret;
 }
 
 /***************************************************************************
@@ -1852,6 +1859,71 @@ static void show_parameter(int parmIndex)
 	printf("\n");
 }
 
+/*
+ * Check the value for a P_ENUM
+ */
+static bool check_enum_parameter(struct parm_struct *parm, const char *value)
+{
+	int i;
+
+	for (i = 0; parm->enum_list[i].name; i++) {
+		if (strwicmp(value, parm->enum_list[i].name) == 0) {
+			return true;
+		}
+	}
+	return false;
+}
+
+/**************************************************************************
+ Check whether the given value is valid for the given parameter name.
+**************************************************************************/
+
+static bool lp_parameter_value_is_valid(const char *parm_name, const char *val)
+{
+	bool ret = false, tmp_bool;
+	int num = lpcfg_map_parameter(parm_name), tmp_int;
+	uint64_t tmp_int64 = 0;
+	struct parm_struct *parm;
+
+	if (num >= 0) {
+		parm = &parm_table[num];
+		switch (parm->type) {
+			case P_BOOL:
+			case P_BOOLREV:
+				ret = set_boolean(val, &tmp_bool);
+				break;
+
+			case P_INTEGER:
+				ret = (sscanf(val, "%d", &tmp_int) == 1);
+				break;
+
+			case P_OCTAL:
+				ret = (sscanf(val, "%o", &tmp_int) == 1);
+				break;
+
+			case P_ENUM:
+				ret = check_enum_parameter(parm, val);
+				break;
+
+			case P_BYTES:
+				if (conv_str_size_error(val, &tmp_int64) &&
+				    tmp_int64 <= INT_MAX) {
+					ret = true;
+				}
+				break;
+
+			case P_CHAR:
+			case P_LIST:
+			case P_STRING:
+			case P_USTRING:
+			case P_CMDLIST:
+				ret = true;
+				break;
+		}
+	}
+	return ret;
+}
+
 /***************************************************************************
  Show all parameter's name, type, [values,] and flags.
 ***************************************************************************/
diff --git a/source3/utils/net_conf_util.c b/source3/utils/net_conf_util.c
index a188097..ec6a479 100644
--- a/source3/utils/net_conf_util.c
+++ b/source3/utils/net_conf_util.c
@@ -61,7 +61,7 @@ bool net_conf_param_valid(const char *service,
 		 * So the value must be invalid.
 		 */
 		d_fprintf(stderr, "invalid value '%s' given for "
-			  "parameter '%s'\n", param, valstr);
+			  "parameter '%s'\n", valstr, param);
 		return false;
 	}
 
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index de929ff..cc65457 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -106,6 +106,7 @@ NTSTATUS connect_to_service(struct net_context *c,
 {
 	NTSTATUS nt_status;
 	int flags = 0;
+	enum smb_signing_setting signing_setting = SMB_SIGNING_DEFAULT;
 
 	c->opt_password = net_prompt_pass(c, c->opt_user_name);
 
@@ -121,12 +122,16 @@ NTSTATUS connect_to_service(struct net_context *c,
 		flags |= CLI_FULL_CONNECTION_USE_CCACHE;
 	}
 
+	if (strequal(service_type, "IPC")) {
+		signing_setting = SMB_SIGNING_IPC_DEFAULT;
+	}
+
 	nt_status = cli_full_connection(cli_ctx, NULL, server_name,
 					server_ss, c->opt_port,
 					service_name, service_type,
 					c->opt_user_name, c->opt_workgroup,
 					c->opt_password, flags,
-					SMB_SIGNING_IPC_DEFAULT);
+					signing_setting);
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		d_fprintf(stderr, _("Could not connect to server %s\n"),
 			  server_name);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list