[PATCH 03/37] param: Use the plus/minus syntax for reading in lists in s3 loadparm

abartlet at samba.org abartlet at samba.org
Fri Jun 20 05:46:18 MDT 2014


From: Garming Sam <garming at catalyst.net.nz>

This changes the behaviour the following parameters:
server services, dcerpc endpoint servers and ntvfs handler

These parameters were introduced with samba4 and are the parameters
which should utilize the newer list syntax. This allows merging
between the setting of parameters.

Change-Id: Id6226b5bede5cd4908f6718bd1b799faf881927d
Signed-off-by: Garming Sam <garming at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
---
 source3/param/loadparm.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 39eee91..c9bfe1e 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2685,6 +2685,37 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
 		}
 
 		case P_LIST:
+		{
+			char **new_list = str_list_make_v3(mem_ctx,
+							pszParmValue, NULL);
+			for (i=0; new_list[i]; i++) {
+				if (*(const char ***)parm_ptr != NULL &&
+				    new_list[i][0] == '+' &&
+				    new_list[i][1])
+				{
+					if (!str_list_check(*(const char ***)parm_ptr,
+							    &new_list[i][1])) {
+						*(const char ***)parm_ptr = str_list_add(*(const char ***)parm_ptr,
+											 &new_list[i][1]);
+					}
+				} else if (*(const char ***)parm_ptr != NULL &&
+					   new_list[i][0] == '-' &&
+					   new_list[i][1])
+				{
+					str_list_remove(*(const char ***)parm_ptr,
+							&new_list[i][1]);
+				} else {
+					if (i != 0) {
+						DEBUG(0, ("Unsupported list syntax for: %s = %s\n",
+							  pszParmName, pszParmValue));
+						return false;
+					}
+					*(const char * const **)parm_ptr = (const char * const *) new_list;
+					break;
+				}
+			}
+			break;
+		}
 		case P_CMDLIST:
 			TALLOC_FREE(*((char ***)parm_ptr));
 			*(char ***)parm_ptr = str_list_make_v3(
-- 
1.9.3



More information about the samba-technical mailing list