02_all_redhat-bug17795.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- hosts_access.c Wed Feb 12 03:13:23 1997
  2. +++ hosts_access.c Wed Jul 19 08:37:02 2000
  3. @@ -240,6 +255,26 @@
  4. }
  5. }
  6. +/* hostfile_match - look up host patterns from file */
  7. +
  8. +static int hostfile_match(path, host)
  9. +char *path;
  10. +struct hosts_info *host;
  11. +{
  12. + char tok[BUFSIZ];
  13. + int match = NO;
  14. + FILE *fp;
  15. +
  16. + if ((fp = fopen(path, "r")) != 0) {
  17. + while (fscanf(fp, "%s", tok) == 1 && !(match = host_match(tok, host)))
  18. + /* void */ ;
  19. + fclose(fp);
  20. + } else if (errno != ENOENT) {
  21. + tcpd_warn("open %s: %m", path);
  22. + }
  23. + return (match);
  24. +}
  25. +
  26. /* host_match - match host name and/or address against pattern */
  27. static int host_match(tok, host)
  28. @@ -267,6 +302,8 @@
  29. tcpd_warn("netgroup support is disabled"); /* not tcpd_jump() */
  30. return (NO);
  31. #endif
  32. + } else if (tok[0] == '/') { /* /file hack */
  33. + return (hostfile_match(tok, host));
  34. } else if (STR_EQ(tok, "KNOWN")) { /* check address and name */
  35. char *name = eval_hostname(host);
  36. return (STR_NE(eval_hostaddr(host), unknown) && HOSTNAME_KNOWN(name));
  37. --- hosts_access.5 2003-08-03 19:09:56.000000000 +0000
  38. +++ hosts_access.5 2003-08-03 19:13:32.000000000 +0000
  39. @@ -91,0 +92,7 @@
  40. +.IP \(bu
  41. +A string that begins with a `/\' character is treated as a file
  42. +name. A host name or address is matched if it matches any host name
  43. +or address pattern listed in the named file. The file format is
  44. +zero or more lines with zero or more host name or address patterns
  45. +separated by whitespace. A file name pattern can be used anywhere
  46. +a host name or address pattern can be used.