From: Alan T. DeKok Date: Tue, 20 Aug 2024 15:55:33 +0000 (-0400) Subject: explicitly mark up sections which we know are unlang X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd73e7a71ee5af4f01de2fdc035aefc2cadb7a9d;p=thirdparty%2Ffreeradius-server.git explicitly mark up sections which we know are unlang in preparation for removing the requirement to use '&' --- diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index bb89744a669..140eddf8c66 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -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. diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index 708a7ef1a70..798735f487e 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -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);