1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

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
This commit is contained in:
Andrew Bartlett 2011-05-08 06:58:19 +02:00
parent d1df1cb714
commit ac82ac4b83

View 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 {