PageRenderTime 24ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/external/bsd/blacklist/diff/named.diff

http://www.minix3.org/
diff | 216 lines | 204 code | 12 blank | 0 comment | 0 complexity | 484f1bfac25bcc94be58349b1871f7c4 MD5 | raw file
Possible License(s): MIT, WTFPL, AGPL-1.0, BSD-3-Clause, GPL-3.0, LGPL-2.0, JSON, 0BSD
  1. --- /dev/null 2015-01-22 01:48:00.000000000 -0500
  2. +++ dist/bin/named/pfilter.c 2015-01-22 01:35:16.000000000 -0500
  3. @@ -0,0 +1,42 @@
  4. +#include <config.h>
  5. +
  6. +#include <isc/platform.h>
  7. +#include <isc/util.h>
  8. +#include <named/types.h>
  9. +#include <named/client.h>
  10. +
  11. +#include <blacklist.h>
  12. +
  13. +#include "pfilter.h"
  14. +
  15. +static struct blacklist *blstate;
  16. +
  17. +void
  18. +pfilter_open(void)
  19. +{
  20. + if (blstate == NULL)
  21. + blstate = blacklist_open();
  22. +}
  23. +
  24. +#define TCP_CLIENT(c) (((c)->attributes & NS_CLIENTATTR_TCP) != 0)
  25. +
  26. +void
  27. +pfilter_notify(isc_result_t res, ns_client_t *client, const char *msg)
  28. +{
  29. + isc_socket_t *socket;
  30. +
  31. + pfilter_open();
  32. +
  33. + if (TCP_CLIENT(client))
  34. + socket = client->tcpsocket;
  35. + else {
  36. + socket = client->udpsocket;
  37. + if (!client->peeraddr_valid)
  38. + return;
  39. + }
  40. + if (socket == NULL)
  41. + return;
  42. + blacklist_sa_r(blstate,
  43. + res != ISC_R_SUCCESS, isc_socket_getfd(socket),
  44. + &client->peeraddr.type.sa, client->peeraddr.length, msg);
  45. +}
  46. --- /dev/null 2015-01-22 01:48:00.000000000 -0500
  47. +++ dist/bin/named/pfilter.h 2015-01-22 01:16:56.000000000 -0500
  48. @@ -0,0 +1,2 @@
  49. +void pfilter_open(void);
  50. +void pfilter_notify(isc_result_t, ns_client_t *, const char *);
  51. Index: bin/named/Makefile
  52. ===================================================================
  53. RCS file: /cvsroot/src/external/bsd/bind/bin/named/Makefile,v
  54. retrieving revision 1.8
  55. diff -u -u -r1.8 Makefile
  56. --- bin/named/Makefile 31 Dec 2013 20:23:12 -0000 1.8
  57. +++ bin/named/Makefile 23 Jan 2015 21:37:09 -0000
  58. @@ -33,7 +33,9 @@
  59. lwaddr.c lwdclient.c lwderror.c \
  60. lwdgabn.c lwdgnba.c lwdgrbn.c lwdnoop.c lwresd.c lwsearch.c \
  61. main.c notify.c query.c server.c sortlist.c statschannel.c \
  62. - tkeyconf.c tsigconf.c \
  63. + pfilter.c tkeyconf.c tsigconf.c \
  64. update.c xfrout.c zoneconf.c ${SRCS_UNIX}
  65. +LDADD+=-lblacklist
  66. +DPADD+=${LIBBLACKLIST}
  67. .include <bsd.prog.mk>
  68. Index: dist/bin/named/client.c
  69. ===================================================================
  70. RCS file: /cvsroot/src/external/bsd/bind/dist/bin/named/client.c,v
  71. retrieving revision 1.11
  72. diff -u -u -r1.11 client.c
  73. --- dist/bin/named/client.c 10 Dec 2014 04:37:51 -0000 1.11
  74. +++ dist/bin/named/client.c 23 Jan 2015 21:37:09 -0000
  75. @@ -65,6 +65,8 @@
  76. #include <named/server.h>
  77. #include <named/update.h>
  78. +#include "pfilter.h"
  79. +
  80. /***
  81. *** Client
  82. ***/
  83. @@ -3101,6 +3103,7 @@
  84. result = ns_client_checkaclsilent(client, sockaddr ? &netaddr : NULL,
  85. acl, default_allow);
  86. + pfilter_notify(result, client, opname);
  87. if (result == ISC_R_SUCCESS)
  88. ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
  89. NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),
  90. Index: dist/bin/named/main.c
  91. ===================================================================
  92. RCS file: /cvsroot/src/external/bsd/bind/dist/bin/named/main.c,v
  93. retrieving revision 1.15
  94. diff -u -u -r1.15 main.c
  95. --- dist/bin/named/main.c 10 Dec 2014 04:37:51 -0000 1.15
  96. +++ dist/bin/named/main.c 23 Jan 2015 21:37:09 -0000
  97. @@ -83,6 +83,9 @@
  98. #ifdef HAVE_LIBXML2
  99. #include <libxml/xmlversion.h>
  100. #endif
  101. +
  102. +#include "pfilter.h"
  103. +
  104. /*
  105. * Include header files for database drivers here.
  106. */
  107. @@ -1206,6 +1209,8 @@
  108. parse_command_line(argc, argv);
  109. + pfilter_open();
  110. +
  111. /*
  112. * Warn about common configuration error.
  113. */
  114. Index: dist/bin/named/query.c
  115. ===================================================================
  116. RCS file: /cvsroot/src/external/bsd/bind/dist/bin/named/query.c,v
  117. retrieving revision 1.17
  118. diff -u -u -r1.17 query.c
  119. --- dist/bin/named/query.c 10 Dec 2014 04:37:52 -0000 1.17
  120. +++ dist/bin/named/query.c 23 Jan 2015 21:37:09 -0000
  121. @@ -65,6 +65,8 @@
  122. #include <named/sortlist.h>
  123. #include <named/xfrout.h>
  124. +#include "pfilter.h"
  125. +
  126. #if 0
  127. /*
  128. * It has been recommended that DNS64 be changed to return excluded
  129. @@ -762,6 +764,8 @@
  130. }
  131. result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE);
  132. + if (result != ISC_R_SUCCESS)
  133. + pfilter_notify(result, client, "validatezonedb");
  134. if ((options & DNS_GETDB_NOLOG) == 0) {
  135. char msg[NS_CLIENT_ACLMSGSIZE("query")];
  136. if (result == ISC_R_SUCCESS) {
  137. @@ -1026,6 +1030,8 @@
  138. result = ns_client_checkaclsilent(client, NULL,
  139. client->view->cacheacl,
  140. ISC_TRUE);
  141. + if (result == ISC_R_SUCCESS)
  142. + pfilter_notify(result, client, "cachedb");
  143. if (result == ISC_R_SUCCESS) {
  144. /*
  145. * We were allowed by the "allow-query-cache" ACL.
  146. Index: dist/bin/named/update.c
  147. ===================================================================
  148. RCS file: /cvsroot/src/external/bsd/bind/dist/bin/named/update.c,v
  149. retrieving revision 1.9
  150. diff -u -u -r1.9 update.c
  151. --- dist/bin/named/update.c 10 Dec 2014 04:37:52 -0000 1.9
  152. +++ dist/bin/named/update.c 23 Jan 2015 21:37:09 -0000
  153. @@ -59,6 +59,8 @@
  154. #include <named/server.h>
  155. #include <named/update.h>
  156. +#include "pfilter.h"
  157. +
  158. /*! \file
  159. * \brief
  160. * This module implements dynamic update as in RFC2136.
  161. @@ -307,6 +309,7 @@
  162. result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE);
  163. if (result != ISC_R_SUCCESS) {
  164. + pfilter_notify(result, client, "queryacl");
  165. dns_name_format(zonename, namebuf, sizeof(namebuf));
  166. dns_rdataclass_format(client->view->rdclass, classbuf,
  167. sizeof(classbuf));
  168. @@ -324,6 +327,7 @@
  169. sizeof(classbuf));
  170. result = DNS_R_REFUSED;
  171. + pfilter_notify(result, client, "updateacl");
  172. ns_client_log(client, NS_LOGCATEGORY_UPDATE_SECURITY,
  173. NS_LOGMODULE_UPDATE, ISC_LOG_INFO,
  174. "update '%s/%s' denied", namebuf, classbuf);
  175. @@ -362,6 +366,7 @@
  176. msg = "disabled";
  177. } else {
  178. result = ns_client_checkaclsilent(client, NULL, acl, ISC_FALSE);
  179. + pfilter_notify(result, client, "updateacl");
  180. if (result == ISC_R_SUCCESS) {
  181. level = ISC_LOG_DEBUG(3);
  182. msg = "approved";
  183. Index: dist/bin/named/xfrout.c
  184. ===================================================================
  185. RCS file: /cvsroot/src/external/bsd/bind/dist/bin/named/xfrout.c,v
  186. retrieving revision 1.7
  187. diff -u -u -r1.7 xfrout.c
  188. --- dist/bin/named/xfrout.c 10 Dec 2014 04:37:52 -0000 1.7
  189. +++ dist/bin/named/xfrout.c 23 Jan 2015 21:37:09 -0000
  190. @@ -54,6 +54,8 @@
  191. #include <named/server.h>
  192. #include <named/xfrout.h>
  193. +#include "pfilter.h"
  194. +
  195. /*! \file
  196. * \brief
  197. * Outgoing AXFR and IXFR.
  198. @@ -822,6 +824,7 @@
  199. &client->peeraddr,
  200. &db);
  201. + pfilter_notify(result, client, "zonexfr");
  202. if (result == ISC_R_NOPERM) {
  203. char _buf1[DNS_NAME_FORMATSIZE];
  204. char _buf2[DNS_RDATACLASS_FORMATSIZE];