param: Use the plus/minus syntax for reading in lists in s3 loadparm
authorGarming Sam <garming@catalyst.net.nz>
Tue, 25 Feb 2014 05:14:44 +0000 (18:14 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 7 Jul 2014 21:32:35 +0000 (23:32 +0200)
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@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
source3/param/loadparm.c

index c4dd803354ebfb7819986b986be627d1a61c377c..0b6a2a4124e678119ebed9afa75046bc75f77e32 100644 (file)
@@ -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(