r23641: Put check for forbidden values in smbconf into a function.
authorMichael Adam <obnox@samba.org>
Thu, 28 Jun 2007 10:32:52 +0000 (10:32 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:40 +0000 (12:23 -0500)
(This will be used in a next step to prevent storing these
values in reg_smbconf.c.)

Michael
(This used to be commit 00be68a8416405e12a27186506f9eb15bca055b3)

source3/lib/util_reg.c
source3/param/loadparm.c

index ed9f0a6817780f231147ac30549388dc31ad4ae1..cf0564509b71cb18bc637e8b8831a18a2ace1ce0 100644 (file)
@@ -117,3 +117,25 @@ void normalize_dbkey(char *key)
        string_sub(key, "\\", "/", len+1);
        strupper_m(key);
 }
+
+/*
+ * check whether a given value name is forbidden in registry (smbconf)
+ */
+BOOL registry_smbconf_valname_forbidden(const char *valname)
+{
+       /* hard code the list of forbidden names here for now */
+       const char *forbidden_valnames[] = {
+               "include",
+               "lock directory",
+               "lock dir",
+               NULL
+       };
+       const char **forbidden = NULL;
+
+       for (forbidden = forbidden_valnames; *forbidden != NULL; forbidden++) {
+               if (strwicmp(valname, *forbidden) == 0) {
+                       return True;
+               }
+       }
+       return False;
+}
index f654dff37ffb8e4ca1441caf9ce7ad5ad1ee29fe..c43a032560553c0a8e149f829b94995e08b2e8c5 100644 (file)
@@ -3165,10 +3165,7 @@ static BOOL process_registry_globals(BOOL (*pfunc)(const char *, const char *))
                                  &type,
                                  &size,
                                  &data_p);
-               if ((strwicmp(valname,"include") == 0) ||
-                   (strwicmp(valname, "lock directory") == 0) ||
-                   (strwicmp(valname, "lock dir") == 0)) 
-               {
+               if (registry_smbconf_valname_forbidden(valname)) {
                        DEBUG(10, ("process_registry_globals: Ignoring "
                                   "parameter '%s' in registry.\n", valname));
                        continue;