1 diff -Nru tcp_wrappers_7.6/hosts_access.5 tcp_wrappers_7.6.new/hosts_access.5
2 --- tcp_wrappers_7.6/hosts_access.5 Thu Feb 8 07:47:40 2001
3 +++ tcp_wrappers_7.6.new/hosts_access.5 Thu Feb 8 07:47:18 2001
5 zero or more lines with zero or more host name or address patterns
6 separated by whitespace. A file name pattern can be used anywhere
7 a host name or address pattern can be used.
9 +Wildcards `*\' and `?\' can be used to match hostnames or IP addresses. This
10 +method of matching cannot be used in conjunction with `net/mask\' matching,
11 +hostname matching beginning with `.\' or IP address matching ending with `.\'.
13 The access control language supports explicit wildcards:
15 diff -Nru tcp_wrappers_7.6/hosts_access.c tcp_wrappers_7.6.new/hosts_access.c
16 --- tcp_wrappers_7.6/hosts_access.c Thu Feb 8 07:47:40 2001
17 +++ tcp_wrappers_7.6.new/hosts_access.c Thu Feb 8 07:51:02 2001
22 +#ifndef DISABLE_WILDCARD_MATCHING
23 + if (strchr(tok, '*') || strchr(tok,'?')) { /* contains '*' or '?' */
24 + return (match_pattern_ylo(string,tok));
28 /* convert IPv4 mapped IPv6 address to IPv4 address */
29 if (STRN_EQ(string, "::ffff:", 7)
32 return ((addr & mask) == net);
36 +#ifndef DISABLE_WILDCARD_MATCHING
37 +/* Note: this feature has been adapted in a pretty straightforward way
38 + from Tatu Ylonen's last SSH version under free license by
39 + Pekka Savola <pekkas@netcore.fi>.
41 + Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
44 +/* Returns true if the given string matches the pattern (which may contain
45 + ? and * as wildcards), and zero if it does not match. */
47 +int match_pattern_ylo(const char *s, const char *pattern)
51 + /* If at end of pattern, accept if also at end of string. */
56 + if (*pattern == '*')
58 + /* Skip the asterisk. */
61 + /* If at end of pattern, accept immediately. */
65 + /* If next character in pattern is known, optimize. */
66 + if (*pattern != '?' && *pattern != '*')
68 + /* Look instances of the next character in pattern, and try
69 + to match starting from those. */
71 + if (*s == *pattern &&
72 + match_pattern_ylo(s + 1, pattern + 1))
78 + /* Move ahead one character at a time and try to match at each
81 + if (match_pattern_ylo(s, pattern))
87 + /* There must be at least one more character in the string. If we are
88 + at the end, fail. */
92 + /* Check if the next character of the string is acceptable. */
93 + if (*pattern != '?' && *pattern != *s)
96 + /* Move to the next character, both in string and in pattern. */
102 +#endif /* DISABLE_WILDCARD_MATCHING */
105 static int masked_match6(net_tok, mask_tok, string)