lib/param: fix usage of 'write list = +Group'
authorStefan Metzmacher <metze@samba.org>
Thu, 23 Aug 2012 13:32:05 +0000 (15:32 +0200)
committerBjoern Jacke <bj@sernet.de>
Fri, 24 Aug 2012 09:28:17 +0000 (11:28 +0200)
metze

Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Fri Aug 24 11:28:17 CEST 2012 on sn-devel-104

lib/param/loadparm.c

index 4751a06198a6173d3338e1700f1feb3bdc09c16e..38140877e76b7d2e16ee150172211d2d91627af3 100644 (file)
@@ -1355,13 +1355,19 @@ 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 (*(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 (new_list[i][0] == '-' && 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 {