Allow parentcs to be NULL when referencing sections
authorAlan T. DeKok <aland@freeradius.org>
Sun, 20 Jul 2008 07:19:18 +0000 (09:19 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 20 Jul 2008 07:19:18 +0000 (09:19 +0200)
src/main/conffile.c

index fb96052..c95567f 100644 (file)
@@ -564,6 +564,8 @@ CONF_ITEM *cf_reference_item(const CONF_SECTION *parentcs,
                 *      "foo.bar.baz" means "from the root"
                 */
        } else if (strchr(p, '.') != NULL) {
+               if (!parentcs) goto no_such_item;
+
                cs = parentcs;
        }
 
@@ -634,7 +636,7 @@ CONF_ITEM *cf_reference_item(const CONF_SECTION *parentcs,
        /*
         *      "foo" is "in the current section, OR in main".
         */
-       if ((p == name) && (cs != parentcs)) {
+       if ((p == name) && (parentcs != NULL) && (cs != parentcs)) {
                cs = parentcs;
                goto retry;
        }