]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
explicitly mark up sections which we know are unlang
authorAlan T. DeKok <aland@freeradius.org>
Tue, 20 Aug 2024 15:55:33 +0000 (11:55 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 21 Aug 2024 11:01:06 +0000 (07:01 -0400)
in preparation for removing the requirement to use '&'

src/lib/server/cf_file.c
src/lib/server/virtual_servers.c

index bb89744a6691b4b706de4d2ad6e7d34ca37ec745..140eddf8c662d4798bd5efb26d41ac25a237d6f5 100644 (file)
@@ -2373,10 +2373,33 @@ check_for_eol:
                        if (strcmp(css->name1, "server") == 0) css->allow_unlang = 2;
                        if (strcmp(css->name1, "policy") == 0) css->allow_unlang = 2;
 
-               } else if ((parent->allow_unlang == 2) && (strcmp(css->name1, "listen") == 0)) { /* hacks for listeners */
-                       css->allow_unlang = css->allow_locals = false;
-
+               } else if (parent->allow_unlang == 2) {
+                       //
+                       // git grep SECTION_NAME src/process/ src/lib/server/process.h | sed 's/.*SECTION_NAME("//;s/",.*//' | sort -u
+                       //
+                       if ((strcmp(css->name1, "accounting") == 0) ||
+                           (strcmp(css->name1, "add") == 0) ||
+                           (strcmp(css->name1, "authenticate") == 0) ||
+                           (strcmp(css->name1, "clear") == 0) ||
+                           (strcmp(css->name1, "deny") == 0) ||
+                           (strcmp(css->name1, "error") == 0) ||
+                           (strcmp(css->name1, "load") == 0) ||
+                           (strcmp(css->name1, "new") == 0) ||
+                           (strcmp(css->name1, "recv") == 0) ||
+                           (strcmp(css->name1, "send") == 0) ||
+                           (strcmp(css->name1, "store") == 0) ||
+                           (strcmp(css->name1, "verify") == 0)) {
+                               css->allow_unlang = css->allow_locals = true;
+
+                       } else if (strcmp(css->name1, "listen") == 0) {
+                               css->allow_unlang = css->allow_locals = false;
+
+                       } else {        
+                               goto check_unlang;
+                       }
+                       
                } else {
+               check_unlang:
                        /*
                         *      Allow unlang if the parent allows it, but don't allow
                         *      unlang in list assignment sections.
index 708a7ef1a70912d1141ff1ddcbadac9140eed5dc..798735f487e28a22d1f8075d97974afe412e7eea 100644 (file)
@@ -306,8 +306,18 @@ int add_compile_list(virtual_server_t *vs, CONF_SECTION *cs, virtual_server_comp
        if (!compile_list) return 0;
 
        for (i = 0; list[i].section; i++) {
-               if (list[i].section->name1 == CF_IDENT_ANY) continue;
+#ifndef NDEBUG
+               /*
+                *      We can't have a wildcard for name1.  It MUST be a real name.
+                *
+                *      The wildcard was allowed previously for ideas which later didn't turn out.
+                */
+               if (list[i].section->name1 == CF_IDENT_ANY) {
+                       fr_assert(0);
+                       continue;
+               }
 
+#endif
                if (virtual_server_section_register(vs, &list[i]) < 0) {
                        cf_log_err(cs, "Failed registering processing section name %s for %s",
                                   list[i].section->name1, name);