From: Alan T. DeKok Date: Tue, 21 Jan 2025 19:23:25 +0000 (-0500) Subject: complain about v3 processing sections being used in v4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e19c62dfa4f5956f8b482b7c2b54dc8986f36ef5;p=thirdparty%2Ffreeradius-server.git complain about v3 processing sections being used in v4 --- diff --git a/src/lib/server/virtual_servers.c b/src/lib/server/virtual_servers.c index b0c846459ca..2b90d45d761 100644 --- a/src/lib/server/virtual_servers.c +++ b/src/lib/server/virtual_servers.c @@ -981,6 +981,41 @@ int virtual_server_compile_sections(virtual_server_t const *vs, tmpl_rules_t con found = 0; + /* + * Complain about v3 things being used in v4. + * + * Don't complain when running in normal mode, because the server will just ignore the new + * sections. But the check_config stuff is generally run before the service starts, and we + * definitely want to tell people when running in debug mode. + */ + if (check_config || DEBUG_ENABLED) { + bool fail = false; + + while ((subcs = cf_section_next(server, subcs)) != NULL) { + char const *name; + + if (cf_section_name2(subcs) != NULL) continue; + + name = cf_section_name1(subcs); + if ((strcmp(name, "authorize") == 0) || + (strcmp(name, "authenticate") == 0) || + (strcmp(name, "post-auth") == 0) || + (strcmp(name, "preacct") == 0) || + (strcmp(name, "accounting") == 0) || + (strcmp(name, "pre-proxy") == 0) || + (strcmp(name, "post-proxy") == 0)) { + cf_log_err(subcs, "Version 3 processing section '%s' is not valid in version 4.", + name); + fail = true; + } + } + + /* + * Complain about _all_ of the sections, and not just the first one. + */ + if (fail) return -1; + } + /* * The sections are in trees, so this isn't as bad as it * looks. It's not O(n^2), but O(n logn). But it could