sanity checks that regex options are only used with the right probe and with libpcre2 support compiled in

This commit is contained in:
Yves Rutschle committed 2026-03-03 22:05:01 +01:00
1 parent 579baae363
commit 4d3aa6c6e0
1 file changed
+19
+19
View File
@@ -220,6 +220,23 @@ static void config_protocols()
}
}
static void config_sanity_regex(const struct sslhcfg_protocols_item* prot)
{
if (prot->regex_patterns_len > 0) {
if (strcmp(prot->name, "regex") != 0) {
print_message(msg_config_error, "name: \"%s\"; host: \"%s\"; port: \"%s\": "
"regex_patterns setting is only applicable to `regex' probe.\n"
"This setting will be ignored\n",
prot->name, prot->host, prot->port);
}
#ifndef ENABLE_REGEX
print_message(msg_config_error, "name: \"%s\"; host: \"%s\"; port: \"%s\": "
"Uses regex_patterns, but libpcre2 support was not compiled in.\n"
"This setting will be ignored.\n",
prot->name, prot->host, prot->port);
#endif
}
}
void config_sanity_check(struct sslhcfg_item* cfg)
{
@@ -249,6 +266,8 @@ void config_sanity_check(struct sslhcfg_item* cfg)
}
}
config_sanity_regex(&cfg->protocols[i]);
if (cfg->protocols[i].is_udp) {
if (cfg->protocols[i].tfo_ok) {
print_message(msg_config_error, "name: \"%s\"; host: \"%s\"; port: \"%s\": "