diff options
Diffstat (limited to 'package/tcp_wrappers/patches/patch-hosts_access_c')
-rw-r--r-- | package/tcp_wrappers/patches/patch-hosts_access_c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/package/tcp_wrappers/patches/patch-hosts_access_c b/package/tcp_wrappers/patches/patch-hosts_access_c new file mode 100644 index 000000000..747d7f64e --- /dev/null +++ b/package/tcp_wrappers/patches/patch-hosts_access_c @@ -0,0 +1,38 @@ +--- 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)); |