OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../tcp_wrappers/0011-tcp_wrappers-7.6-cidr-support.patch
  5. # Copyright (C) 2011 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. diff -ruN tcp_wrappers_7.6.orig/hosts_access.5 tcp_wrappers_7.6/hosts_access.5
  17. --- tcp_wrappers_7.6.orig/hosts_access.5 2003-08-21 03:15:36.000000000 +0200
  18. +++ tcp_wrappers_7.6/hosts_access.5 2003-08-21 03:15:31.000000000 +0200
  19. @@ -90,6 +90,10 @@
  20. pattern `131.155.72.0/255.255.254.0\' matches every address in the
  21. range `131.155.72.0\' through `131.155.73.255\'.
  22. .IP \(bu
  23. +An expression of the form `n.n.n.n/mm' is interpreted as a
  24. +`net/masklength' pair, where `mm' is the number of consecutive `1'
  25. +bits in the netmask applied to the `n.n.n.n' address.
  26. +.IP \(bu
  27. An expression of the form `[n:n:n:n:n:n:n:n]/m\' is interpreted as a
  28. `[net]/prefixlen\' pair. An IPv6 host address is matched if
  29. `prefixlen\' bits of `net\' is equal to the `prefixlen\' bits of the
  30. diff -ruN tcp_wrappers_7.6.orig/hosts_access.c tcp_wrappers_7.6/hosts_access.c
  31. --- tcp_wrappers_7.6.orig/hosts_access.c 2003-08-21 03:15:36.000000000 +0200
  32. +++ tcp_wrappers_7.6/hosts_access.c 2003-08-21 03:09:30.000000000 +0200
  33. @@ -417,7 +417,8 @@
  34. if ((addr = dot_quad_addr(string)) == INADDR_NONE)
  35. return (NO);
  36. if ((net = dot_quad_addr(net_tok)) == INADDR_NONE
  37. - || (mask = dot_quad_addr(mask_tok)) == INADDR_NONE) {
  38. + || ((mask = dot_quad_addr(mask_tok)) == INADDR_NONE
  39. + && (mask = cidr_mask_addr(mask_tok)) == 0)) {
  40. #ifndef INET6
  41. tcpd_warn("bad net/mask expression: %s/%s", net_tok, mask_tok);
  42. #endif
  43. diff -ruN tcp_wrappers_7.6.orig/misc.c tcp_wrappers_7.6/misc.c
  44. --- tcp_wrappers_7.6.orig/misc.c 2003-08-21 03:15:36.000000000 +0200
  45. +++ tcp_wrappers_7.6/misc.c 2003-08-21 03:09:30.000000000 +0200
  46. @@ -107,3 +107,17 @@
  47. }
  48. return (runs == 4 ? inet_addr(str) : INADDR_NONE);
  49. }
  50. +
  51. +/* cidr_mask_addr - convert cidr netmask length to internal form */
  52. +
  53. +unsigned long cidr_mask_addr(str)
  54. +char *str;
  55. +{
  56. + int maskbits;
  57. +
  58. + maskbits = atoi(str);
  59. + if (maskbits < 1 || maskbits > 32)
  60. + return (0);
  61. + return htonl(0xFFFFFFFF << (32 - maskbits));
  62. +}
  63. +
  64. diff -ruN tcp_wrappers_7.6.orig/tcpdchk.c tcp_wrappers_7.6/tcpdchk.c
  65. --- tcp_wrappers_7.6.orig/tcpdchk.c 2003-08-21 03:15:36.000000000 +0200
  66. +++ tcp_wrappers_7.6/tcpdchk.c 2003-08-21 03:09:30.000000000 +0200
  67. @@ -497,12 +497,12 @@
  68. int mask_len;
  69. if ((dot_quad_addr(pat) == INADDR_NONE
  70. - || dot_quad_addr(mask) == INADDR_NONE)
  71. + || dot_quad_addr(mask) == INADDR_NONE && cidr_mask_addr(mask) == 0)
  72. && (!is_inet6_addr(pat)
  73. || ((mask_len = atoi(mask)) < 0 || mask_len > 128)))
  74. #else
  75. if (dot_quad_addr(pat) == INADDR_NONE
  76. - || dot_quad_addr(mask) == INADDR_NONE)
  77. + || dot_quad_addr(mask) == INADDR_NONE && cidr_mask_addr(mask) == 0)
  78. #endif
  79. tcpd_warn("%s/%s: bad net/mask pattern", pat, mask);
  80. } else if (STR_EQ(pat, "FAIL")) { /* obsolete */