From 6cc33820d166bc790c79f8e42aec8f53bcefd2ba Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Tue, 6 Jun 2017 01:11:29 +0100 Subject: [PATCH] tls: permit wildcard ALPN/SNI values Use fnmatch(3) to provide support for glob style wildcard values in the ALPN and SNI parameters of the TLS probe. Signed-off-by: Jonathan McCrohan --- tls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tls.c b/tls.c index 8640dec..fc4ae38 100644 --- a/tls.c +++ b/tls.c @@ -30,6 +30,7 @@ */ #include #include /* malloc() */ +#include /* fnmatch() */ #include "tls.h" #define TLS_HEADER_LEN 5 @@ -290,7 +291,7 @@ has_match(char** list, const char* name, size_t name_len) { for (item = list; *item; item++) { if (verbose) fprintf(stderr, "matching [%.*s] with [%s]\n", (int)name_len, name, *item); - if(!strncmp(*item, name, name_len)) { + if(!fnmatch(*item, name, 0)) { return 1; } }