Skip to content

Commit

Permalink
complain about v3 processing sections being used in v4
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Jan 21, 2025
1 parent 48925ed commit e19c62d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/lib/server/virtual_servers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e19c62d

Please sign in to comment.