version 1.29, 2013/11/20 20:54:10 |
version 1.30, 2015/05/04 06:10:48 |
|
|
* indicate negation). Returns -1 if negation matches, 1 if there is |
* indicate negation). Returns -1 if negation matches, 1 if there is |
* a positive match, 0 if there is no match at all. |
* a positive match, 0 if there is no match at all. |
*/ |
*/ |
|
|
int |
int |
match_pattern_list(const char *string, const char *pattern, u_int len, |
match_pattern_list(const char *string, const char *pattern, int dolower) |
int dolower) |
|
{ |
{ |
char sub[1024]; |
char sub[1024]; |
int negated; |
int negated; |
int got_positive; |
int got_positive; |
u_int i, subi; |
u_int i, subi, len = strlen(pattern); |
|
|
got_positive = 0; |
got_positive = 0; |
for (i = 0; i < len;) { |
for (i = 0; i < len;) { |
|
|
* a positive match, 0 if there is no match at all. |
* a positive match, 0 if there is no match at all. |
*/ |
*/ |
int |
int |
match_hostname(const char *host, const char *pattern, u_int len) |
match_hostname(const char *host, const char *pattern) |
{ |
{ |
return match_pattern_list(host, pattern, len, 1); |
return match_pattern_list(host, pattern, 1); |
} |
} |
|
|
/* |
/* |
|
|
return 0; |
return 0; |
|
|
/* negative hostname match */ |
/* negative hostname match */ |
if ((mhost = match_hostname(host, patterns, strlen(patterns))) == -1) |
if ((mhost = match_hostname(host, patterns)) == -1) |
return 0; |
return 0; |
/* no match at all */ |
/* no match at all */ |
if (mhost == 0 && mip == 0) |
if (mhost == 0 && mip == 0) |