summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
Diffstat (limited to 'match.c')
-rw-r--r--match.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/match.c b/match.c
index e3c993073..238947778 100644
--- a/match.c
+++ b/match.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: match.c,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ 1/* $OpenBSD: match.c,v 1.27 2008/06/10 23:06:19 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
@@ -183,7 +183,8 @@ match_hostname(const char *host, const char *pattern, u_int len)
183 183
184/* 184/*
185 * returns 0 if we get a negative match for the hostname or the ip 185 * returns 0 if we get a negative match for the hostname or the ip
186 * or if we get no match at all. returns 1 otherwise. 186 * or if we get no match at all. returns -1 on error, or 1 on
187 * successful match.
187 */ 188 */
188int 189int
189match_host_and_ip(const char *host, const char *ipaddr, 190match_host_and_ip(const char *host, const char *ipaddr,
@@ -191,9 +192,12 @@ match_host_and_ip(const char *host, const char *ipaddr,
191{ 192{
192 int mhost, mip; 193 int mhost, mip;
193 194
194 /* negative ipaddr match */ 195 /* error in ipaddr match */
195 if ((mip = match_hostname(ipaddr, patterns, strlen(patterns))) == -1) 196 if ((mip = addr_match_list(ipaddr, patterns)) == -2)
197 return -1;
198 else if (mip == -1) /* negative ip address match */
196 return 0; 199 return 0;
200
197 /* negative hostname match */ 201 /* negative hostname match */
198 if ((mhost = match_hostname(host, patterns, strlen(patterns))) == -1) 202 if ((mhost = match_hostname(host, patterns, strlen(patterns))) == -1)
199 return 0; 203 return 0;