From ac82ac4b83d3910734943bbc4caba5ef1efefe06 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 8 May 2011 06:58:19 +0200 Subject: s4-param cope with doulbe-parsing of -foo and +foo lists 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source4/param') diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index ca87870c72..b101054318 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -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 { -- cgit