summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-03-10 04:24:55 +0000
committerDamien Miller <djm@mindrot.org>2017-03-10 15:35:40 +1100
commitdd3e2298663f4cc1a06bc69582d00dcfee27d73c (patch)
treed12f9a4f44e2ffe0e4ea8b805549654c08425963 /match.c
parent77a9be9446697fe8b5499fe651f4a82a71a4b51f (diff)
upstream commit
make hostname matching really insensitive to case; bz#2685, reported by Petr Cerny; ok dtucker@ Upstream-ID: e467622ff154269e36ba8b6c9e3d105e1c4a9253
Diffstat (limited to 'match.c')
-rw-r--r--match.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/match.c b/match.c
index a7585e2bd..3cf40306b 100644
--- a/match.c
+++ b/match.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: match.c,v 1.36 2017/03/10 03:52:48 djm Exp $ */ 1/* $OpenBSD: match.c,v 1.37 2017/03/10 04:24:55 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -42,9 +42,11 @@
42#include <ctype.h> 42#include <ctype.h>
43#include <stdlib.h> 43#include <stdlib.h>
44#include <string.h> 44#include <string.h>
45#include <stdio.h>
45 46
46#include "xmalloc.h" 47#include "xmalloc.h"
47#include "match.h" 48#include "match.h"
49#include "misc.h"
48 50
49/* 51/*
50 * Returns true if the given string matches the pattern (which may contain ? 52 * Returns true if the given string matches the pattern (which may contain ?
@@ -177,7 +179,13 @@ match_pattern_list(const char *string, const char *pattern, int dolower)
177int 179int
178match_hostname(const char *host, const char *pattern) 180match_hostname(const char *host, const char *pattern)
179{ 181{
180 return match_pattern_list(host, pattern, 1); 182 char *hostcopy = xstrdup(host);
183 int r;
184
185 lowercase(hostcopy);
186 r = match_pattern_list(hostcopy, pattern, 1);
187 free(hostcopy);
188 return r;
181} 189}
182 190
183/* 191/*