Don't arbitrarily clean all parametric options in add_a_service(),
authorJeremy Allison <jra@samba.org>
Sat, 16 Oct 2010 05:27:10 +0000 (22:27 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 16 Oct 2010 06:46:19 +0000 (06:46 +0000)
that is called from many places, not just smb.conf processing. Only
clean parametric options when doing actual smb.conf reading (or
registry equivalent).

Michael Adams, Volker, Metze, please check.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Oct 16 06:46:19 UTC 2010 on sn-devel-104

source3/param/loadparm.c

index f9a908dce9aaaf4873c60f144a1554fa0f21d289..8dadebfa8915d97e040e230af84decde299fc5b7 100644 (file)
@@ -6277,9 +6277,6 @@ static int add_a_service(const struct service *pservice, const char *name)
        if (name) {
                i = getservicebyname(name, NULL);
                if (i >= 0) {
-                       /* Clean all parametric options for service */
-                       /* They will be added during parsing again */
-                       free_param_opts(&ServicePtrs[i]->param_opt);
                        return (i);
                }
        }
@@ -8111,6 +8108,9 @@ static bool do_section(const char *pszSectionName, void *userdata)
                        DEBUG(0, ("Failed to add a new service\n"));
                        return (False);
                }
+               /* Clean all parametric options for service */
+               /* They will be added during parsing again */
+               free_param_opts(&ServicePtrs[iServiceIndex]->param_opt);
        }
 
        return (bRetval);