summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2015-08-19 17:00:17 +0100
committerColin Watson <cjwatson@debian.org>2015-08-19 17:00:17 +0100
commit544df7a04ae5b5c1fc30be7c445ad685d7a02dc9 (patch)
tree33d2a87dd50fe5894ac6ec4579c83401b7ab00a4 /match.c
parentbaccdb349b31c47cd76fb63211f754ed33a9707e (diff)
parent7de4b03a6e4071d454b72927ffaf52949fa34545 (diff)
Import openssh_6.9p1.orig.tar.gz
Diffstat (limited to 'match.c')
-rw-r--r--match.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/match.c b/match.c
index c35e32896..913b6bae0 100644
--- a/match.c
+++ b/match.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: match.c,v 1.29 2013/11/20 20:54:10 deraadt Exp $ */ 1/* $OpenBSD: match.c,v 1.30 2015/05/04 06:10:48 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
@@ -115,15 +115,13 @@ match_pattern(const char *s, const char *pattern)
115 * indicate negation). Returns -1 if negation matches, 1 if there is 115 * indicate negation). Returns -1 if negation matches, 1 if there is
116 * a positive match, 0 if there is no match at all. 116 * a positive match, 0 if there is no match at all.
117 */ 117 */
118
119int 118int
120match_pattern_list(const char *string, const char *pattern, u_int len, 119match_pattern_list(const char *string, const char *pattern, int dolower)
121 int dolower)
122{ 120{
123 char sub[1024]; 121 char sub[1024];
124 int negated; 122 int negated;
125 int got_positive; 123 int got_positive;
126 u_int i, subi; 124 u_int i, subi, len = strlen(pattern);
127 125
128 got_positive = 0; 126 got_positive = 0;
129 for (i = 0; i < len;) { 127 for (i = 0; i < len;) {
@@ -177,9 +175,9 @@ match_pattern_list(const char *string, const char *pattern, u_int len,
177 * a positive match, 0 if there is no match at all. 175 * a positive match, 0 if there is no match at all.
178 */ 176 */
179int 177int
180match_hostname(const char *host, const char *pattern, u_int len) 178match_hostname(const char *host, const char *pattern)
181{ 179{
182 return match_pattern_list(host, pattern, len, 1); 180 return match_pattern_list(host, pattern, 1);
183} 181}
184 182
185/* 183/*
@@ -200,7 +198,7 @@ match_host_and_ip(const char *host, const char *ipaddr,
200 return 0; 198 return 0;
201 199
202 /* negative hostname match */ 200 /* negative hostname match */
203 if ((mhost = match_hostname(host, patterns, strlen(patterns))) == -1) 201 if ((mhost = match_hostname(host, patterns)) == -1)
204 return 0; 202 return 0;
205 /* no match at all */ 203 /* no match at all */
206 if (mhost == 0 && mip == 0) 204 if (mhost == 0 && mip == 0)