tcpwrappers.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. Index: Makefile
  2. --- Makefile.orig 2003-01-03 19:52:40.000000000 +0100
  3. +++ Makefile 2003-10-21 12:08:03.000000000 +0200
  4. @@ -128,12 +128,12 @@
  5. 386bsd netbsd bsdos:
  6. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  7. LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
  8. - EXTRA_CFLAGS=VSYSLOG= all
  9. + EXTRA_CFLAGS= VSYSLOG= all
  10. freebsd:
  11. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  12. LIBS= RANLIB=ranlib ARFLAGS=rv AUX_OBJ= NETGROUP= TLI= \
  13. - EXTRA_CFLAGS=VSYSLOG= all
  14. + EXTRA_CFLAGS=-I. VSYSLOG= all
  15. linux:
  16. @make REAL_DAEMON_DIR=$(REAL_DAEMON_DIR) STYLE=$(STYLE) \
  17. Index: tcpd.h
  18. --- tcpd.h.orig 2003-01-05 02:15:59.000000000 +0100
  19. +++ tcpd.h 2003-10-21 12:08:03.000000000 +0200
  20. @@ -7,6 +7,8 @@
  21. #ifndef TCP_WRAPPERS_HEADER
  22. #define TCP_WRAPPERS_HEADER
  23. +#include <sys/types.h>
  24. +#include <sys/socket.h>
  25. #include <netinet/in.h>
  26. #include <netdb.h>
  27. Index: fix_options.c
  28. --- fix_options.c.orig 2003-01-05 02:27:10.000000000 +0100
  29. +++ fix_options.c 2003-10-21 12:08:31.000000000 +0200
  30. @@ -47,7 +47,14 @@
  31. clean_exit(request);
  32. }
  33. if (ADDR_FAM(&ss) == AF_INET) {
  34. +#if defined(__FreeBSD__) || defined(__sun__)
  35. + unsigned char optbuf[BUFFER_SIZE / 3];
  36. + int optlen;
  37. + struct in_addr dummy;
  38. + unsigned char *ucp;
  39. +#else
  40. struct ip_opts optbuf;
  41. +#endif
  42. char lbuf[BUFFER_SIZE], *lp, *cp;
  43. struct protoent *ip;
  44. int optsize = sizeof(optbuf);
  45. @@ -65,9 +72,15 @@
  46. * here was wrong.
  47. */
  48. +#if defined(__FreeBSD__) || defined(__sun__)
  49. +#define ADDR_LEN sizeof(dummy.s_addr)
  50. + for (ucp = optbuf + ADDR_LEN; ucp < optbuf + optsize; ucp += optlen) {
  51. + u_char c = ucp[IPOPT_OPTVAL];
  52. +#else
  53. for (i = 0; (void *)&optbuf.ip_opts[i] - (void *)&optbuf <
  54. optsize; ) {
  55. u_char c = (u_char)optbuf.ip_opts[i];
  56. +#endif
  57. if (c == IPOPT_LSRR || c == IPOPT_SSRR) {
  58. syslog(LOG_WARNING,
  59. "refused connect from %s with IP source routing options",
  60. @@ -77,7 +90,17 @@
  61. }
  62. if (c == IPOPT_EOL)
  63. break;
  64. +#if defined(__FreeBSD__) || defined(__sun__)
  65. + if (c == IPOPT_NOP)
  66. + optlen = 1;
  67. + else {
  68. + optlen = cp[IPOPT_OLEN];
  69. + if (optlen <= 0) /* Do not loop! */
  70. + break;
  71. + }
  72. +#else
  73. i += (c == IPOPT_NOP) ? 1 : (u_char)optbuf.ip_opts[i+1];
  74. +#endif
  75. }
  76. lp = lbuf;
  77. Index: internal.h
  78. --- internal.h.orig 2003-01-05 00:37:53.000000000 +0100
  79. +++ internal.h 2003-10-21 12:08:03.000000000 +0200
  80. @@ -7,6 +7,7 @@
  81. #ifndef IMPL_HEADER
  82. #define IMPL_HEADER
  83. +#include <sys/types.h>
  84. #include <sys/socket.h>
  85. #include <stdio.h>
  86. #include <string.h>