s4-param cope with doulbe-parsing of -foo and +foo lists
authorAndrew Bartlett <abartlet@samba.org>
Sun, 8 May 2011 04:58:19 +0000 (06:58 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 8 May 2011 15:36:25 +0000 (17:36 +0200)
For some reason these lists are parsed twice, and so any -foo was
failing as it was already removed the first time.

Andrew Bartlett

source4/param/loadparm.c

index ca87870c722ae3bd809121bc38c5d702234b7bc9..b101054318d0504469a7baa0fd31d7953ac30000 100644 (file)
@@ -1711,17 +1711,23 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
                        char **new_list = str_list_make(mem_ctx,
                                                        pszParmValue, NULL);
                        for (i=0; new_list[i]; i++) {
-                               if (new_list[i][0] == '+' && new_list[i][1]) {
+                               if (new_list[i][0] == '+' && new_list[i][1] &&
+                                   (!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 (new_list[i][0] == '-' && new_list[i][1]) {
+#if 0 /* This is commented out because we sometimes parse the list
+       * twice, and so we can't assert on this */
                                        if (!str_list_check(*(const char ***)parm_ptr,
                                                            &new_list[i][1])) {
-                                               DEBUG(0, ("Unsupported value for: %s = %s, %s is not in the original list\n",
-                                                         pszParmName, pszParmValue, new_list[i]));
+                                               DEBUG(0, ("Unsupported value for: %s = %s, %s is not in the original list [%s]\n",
+                                                         pszParmName, pszParmValue, new_list[i],
+                                                         str_list_join_shell(mem_ctx, *(const char ***)parm_ptr, ' ')));
                                                return false;
 
                                        }
+#endif
                                        str_list_remove(*(const char ***)parm_ptr,
                                                        &new_list[i][1]);
                                } else {