diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2017-03-10 04:24:56 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2017-03-10 04:24:56 +0000 |
commit | f822885c89c0c50976259361ef7c5c89731e053c (patch) | |
tree | a61cbae291aa0f203ec14b705e8ee447162e3992 | |
parent | 0d74ecd795e1a22afca664c7a966372ca05cd810 (diff) |
make hostname matching really insensitive to case; bz#2685,
reported by Petr Cerny; ok dtucker@
-rw-r--r-- | usr.bin/ssh/match.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/ssh/match.c b/usr.bin/ssh/match.c index 533768f0644..6a0c2c21236 100644 --- a/usr.bin/ssh/match.c +++ b/usr.bin/ssh/match.c @@ -1,4 +1,4 @@ -/* $OpenBSD: match.c,v 1.36 2017/03/10 03:52:48 djm Exp $ */ +/* $OpenBSD: match.c,v 1.37 2017/03/10 04:24:55 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -40,9 +40,11 @@ #include <ctype.h> #include <stdlib.h> #include <string.h> +#include <stdio.h> #include "xmalloc.h" #include "match.h" +#include "misc.h" /* * Returns true if the given string matches the pattern (which may contain ? @@ -175,7 +177,13 @@ match_pattern_list(const char *string, const char *pattern, int dolower) int match_hostname(const char *host, const char *pattern) { - return match_pattern_list(host, pattern, 1); + char *hostcopy = xstrdup(host); + int r; + + lowercase(hostcopy); + r = match_pattern_list(hostcopy, pattern, 1); + free(hostcopy); + return r; } /* |