changeset 21255:2bb6952b3a97

config: Match multiple names in local_name This can significantly reduce memory usage when using a UCC certificate with multiple names by only loading the certificate and key once.
author J. Nick Koston <nick@cpanel.net>
date Thu, 01 Dec 2016 01:38:02 -0600
parents a29415ef148d
children 4ac3461df334
files src/config/config-filter.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/config/config-filter.c	Thu Nov 24 04:06:22 2016 +0200
+++ b/src/config/config-filter.c	Thu Dec 01 01:38:02 2016 -0600
@@ -37,7 +37,17 @@
 	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 */