]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make templates work again
authorAlan T. DeKok <aland@freeradius.org>
Sat, 14 Nov 2009 09:29:40 +0000 (10:29 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 14 Nov 2009 09:29:56 +0000 (10:29 +0100)
src/main/conffile.c

index 406285bae64b1b25f7d709be38a3a607072b5f47..b391c22fb4759103cd0fce3f28db4334aa4ff9e2 100644 (file)
@@ -1462,12 +1462,19 @@ static int cf_section_read(const char *filename, int *lineno, FILE *fp,
 
               if (strcasecmp(buf1, "$template") == 0) {
                       CONF_ITEM *ci;
-                      CONF_SECTION *parentcs;
+                      CONF_SECTION *parentcs, *templatecs;
                       t2 = getword(&ptr, buf2, sizeof(buf2));
 
                       parentcs = cf_top_section(current);
 
-                      ci = cf_reference_item(parentcs, this, buf2);
+                      templatecs = cf_section_sub_find(parentcs, "templates");
+                      if (!templatecs) {
+                               radlog(L_ERR, "%s[%d]: No \"templates\" section for reference \"%s\"",
+                                      filename, *lineno, buf2);
+                               return -1;
+                      }
+
+                      ci = cf_reference_item(parentcs, templatecs, buf2);
                       if (!ci || (ci->type != CONF_ITEM_SECTION)) {
                                radlog(L_ERR, "%s[%d]: Reference \"%s\" not found",
                                       filename, *lineno, buf2);