1. tinydns patch

query のcaseを保ったlogを出力するための修正 -- ToshinoriMaeno 2015-11-13 07:50:09

*** server.c.1  2014-06-29 11:50:58.000000000 +0900
--- server.c    2015-11-11 18:59:30.000000000 +0900
***************
*** 24,29 ****
--- 24,30 ----
  static int len;
  
  static char *q;
+ static char *q2 = 0;
  
  static int doit(void)
  {
***************
*** 54,61 ****
    if (header[2] & 126) goto NOTIMP;
    if (byte_equal(qtype,2,DNS_T_AXFR)) goto NOTIMP;
  
!   case_lowerb(q,dns_domain_length(q));
!   if (!respond(q,qtype,ip, port)) {
      qlog(ip,port,header,q,qtype," - ");
      return 0;
    }
--- 55,63 ----
    if (header[2] & 126) goto NOTIMP;
    if (byte_equal(qtype,2,DNS_T_AXFR)) goto NOTIMP;
  
!   if (!dns_domain_copy(&q2,q)) return 0;  /* 11-15 */
!   case_lowerb(q2,dns_domain_length(q2));
!   if (!respond(q2,qtype,ip, port)) {
      qlog(ip,port,header,q,qtype," - ");
      return 0;
    }

*** qlog.c.orig 2015-11-11 14:00:26.000000000 +0900
--- qlog.c      2015-11-11 14:04:36.000000000 +0900
***************
*** 48,55 ****
        while (ch--) {
          ch2 = *q++;
          if ((ch2 >= 'A') && (ch2 <= 'Z'))
!         ch2 += 32;
!         if (((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= '0') && (ch2 <= '9')) || (ch2 == '-') || (ch2 == '_'))
          put(ch2);
          else
          octal(ch2);
--- 48,55 ----
        while (ch--) {
          ch2 = *q++;
          if ((ch2 >= 'A') && (ch2 <= 'Z'))
!         put(ch2); /* ch2 += 32;*/
!         else if (((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= '0') && (ch2 <= '9')) || (ch2 == '-') || (ch2 == '_'))
          put(ch2);
          else
          octal(ch2);


-- ToshinoriMaeno 2015-12-06 23:05:52

MoinQ: djbdns/tinydns/query-case-patch (last edited 2021-05-20 14:37:52 by ToshinoriMaeno)