1234567891011121314151617181920212223242526272829303132333435363738 |
- --- tcp_wrappers_7.6.orig/hosts_access.c 1997-02-12 02:13:23.000000000 +0100
- +++ tcp_wrappers_7.6/hosts_access.c 2009-06-05 18:45:03.000000000 +0200
- @@ -240,6 +240,26 @@ struct request_info *request;
- }
- }
-
- +/* hostfile_match - look up host patterns from file */
- +
- +static int hostfile_match(path, host)
- +char *path;
- +struct hosts_info *host;
- +{
- + char tok[BUFSIZ];
- + int match = NO;
- + FILE *fp;
- +
- + if ((fp = fopen(path, "r")) != 0) {
- + while (fscanf(fp, "%s", tok) == 1 && !(match = host_match(tok, host)))
- + /* void */ ;
- + fclose(fp);
- + } else if (errno != ENOENT) {
- + tcpd_warn("open %s: %m", path);
- + }
- + return (match);
- +}
- +
- /* host_match - match host name and/or address against pattern */
-
- static int host_match(tok, host)
- @@ -267,6 +287,8 @@ struct host_info *host;
- tcpd_warn("netgroup support is disabled"); /* not tcpd_jump() */
- return (NO);
- #endif
- + } else if (tok[0] == '/') { /* /file hack */
- + return (hostfile_match(tok, host));
- } else if (STR_EQ(tok, "KNOWN")) { /* check address and name */
- char *name = eval_hostname(host);
- return (STR_NE(eval_hostaddr(host), unknown) && HOSTNAME_KNOWN(name));
|