Skip to content

Commit

Permalink
config: Match multiple names in local_name
Browse files Browse the repository at this point in the history
This can significantly reduce memory usage when using
a UCC certificate with multiple names by only loading
the certificate and key once.
  • Loading branch information
bdraco authored and sirainen committed Dec 3, 2016
1 parent 3002d94 commit cda8cd7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/config/config-filter.c
Expand Up @@ -37,7 +37,17 @@ static bool config_filter_match_rest(const struct config_filter *mask,
if (mask->local_name != NULL) {
if (filter->local_name == NULL)
return FALSE;
if (dns_match_wildcard(filter->local_name, mask->local_name) != 0)
/* Handle multiple names seperated by spaces in local_name
* Ex: local_name "mail.domain.tld domain.tld mx.domain.tld" { ... } */
const char *const *local_name = t_strsplit_spaces(mask->local_name, " ");
bool matched = FALSE;
for (; *local_name != NULL; local_name++) {
if (dns_match_wildcard(filter->local_name, *local_name) == 0) {
matched = TRUE;
break;
}
}
if (!matched)
return FALSE;
}
/* FIXME: it's not comparing full masks */
Expand Down

0 comments on commit cda8cd7

Please sign in to comment.