Skip to content

Commit 50792a5

Browse files
committed
Force SSL/TLS configuration in SSL proxyspecs
SSL proxyspecs should always have a complete SSL/TLS configuration, even if their filter rules have complete SSL/TLS configuration, because it is very difficult, if not impossible, to check the coverage of filter rules to make sure we have complete SSL/TLS configuration if no filter rules matches, in which case sslproxy can crash
1 parent cc41d43 commit 50792a5

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/main.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,19 +666,12 @@ main(int argc, char *argv[])
666666
// and global options are copied into proxyspecs and then into struct filter rules anyway
667667
for (proxyspec_t *spec = global->spec; spec; spec = spec->next) {
668668
if (spec->ssl || spec->upgrade) {
669-
// Either the proxyspec itself or all of the filtering rules copied into or defined in the proxyspec must have a complete SSL/TLS configuration
669+
// SSL proxyspecs should always have a complete SSL/TLS configuration, even if their filter rules have complete SSL/TLS configuration,
670+
// because it is very difficult, if not impossible, to check the coverage of filter rules to make sure we have complete SSL/TLS configuration
671+
// if no filter rules matches, in which case sslproxy can crash
670672
if (main_check_opts(spec->opts, spec->conn_opts, argv0, "ProxySpec") == -1) {
671-
if (!spec->opts->filter_rules)
672-
exit(EXIT_FAILURE);
673-
674-
filter_rule_t *rule = spec->opts->filter_rules;
675-
while (rule) {
676-
if (!rule->action.conn_opts || (main_check_opts(spec->opts, rule->action.conn_opts, argv0, "FilterRule") == -1)) {
677-
fprintf(stderr, "%s: no or incomplete SSL/TLS configuration in ProxySpec and/or FilterRule.\n", argv0);
678-
exit(EXIT_FAILURE);
679-
}
680-
rule = rule->next;
681-
}
673+
fprintf(stderr, "%s: no or incomplete SSL/TLS configuration in ProxySpec.\n", argv0);
674+
exit(EXIT_FAILURE);
682675
}
683676
}
684677
}

0 commit comments

Comments
 (0)