2
0

0005-Fix-logging-in-cf5984367bc6a949e3803a576512c5a7bc48e.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From cbb5b17ad8e03e08ade62376a4f6a2066e55960d Mon Sep 17 00:00:00 2001
  2. From: Simon Kelley <[email protected]>
  3. Date: Tue, 23 Oct 2018 23:45:57 +0100
  4. Subject: [PATCH 05/30] Fix logging in cf5984367bc6a949e3803a576512c5a7bc48ebab
  5. Signed-off-by: Kevin Darbyshire-Bryant <[email protected]>
  6. ---
  7. src/rfc1035.c | 27 ++++++++++++++++++---------
  8. 1 file changed, 18 insertions(+), 9 deletions(-)
  9. --- a/src/rfc1035.c
  10. +++ b/src/rfc1035.c
  11. @@ -1335,7 +1335,6 @@ size_t answer_request(struct dns_header
  12. {
  13. unsigned long ttl = daemon->local_ttl;
  14. int ok = 1;
  15. - log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
  16. #ifndef NO_ID
  17. /* Dynamically generate stat record */
  18. if (t->stat != 0)
  19. @@ -1345,11 +1344,14 @@ size_t answer_request(struct dns_header
  20. ok = 0;
  21. }
  22. #endif
  23. - if (ok && add_resource_record(header, limit, &trunc, nameoffset, &ansp,
  24. - ttl, NULL,
  25. - T_TXT, t->class, "t", t->len, t->txt))
  26. - anscount++;
  27. -
  28. + if (ok)
  29. + {
  30. + log_query(F_CONFIG | F_RRNAME, name, NULL, "<TXT>");
  31. + if (add_resource_record(header, limit, &trunc, nameoffset, &ansp,
  32. + ttl, NULL,
  33. + T_TXT, t->class, "t", t->len, t->txt))
  34. + anscount++;
  35. + }
  36. }
  37. }
  38. }
  39. @@ -1357,12 +1359,19 @@ size_t answer_request(struct dns_header
  40. if (qclass == C_CHAOS)
  41. {
  42. - /* don't forward *.bind and *.server chaos queries */
  43. + /* don't forward *.bind and *.server chaos queries - always reply with NOTIMP */
  44. if (hostname_issubdomain("bind", name) || hostname_issubdomain("server", name))
  45. {
  46. if (!ans)
  47. - notimp = 1, auth = 0;
  48. - ans = 1;
  49. + {
  50. + notimp = 1, auth = 0;
  51. + if (!dryrun)
  52. + {
  53. + addr.addr.rcode.rcode = NOTIMP;
  54. + log_query(F_CONFIG | F_RCODE, name, &addr, NULL);
  55. + }
  56. + ans = 1;
  57. + }
  58. }
  59. }