busybox-1.2.2.1-max_host_len_40.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. diff -ur busybox-1.2.2.1/networking/dnsd.c busybox-1.2.2.1-patched/networking/dnsd.c
  2. --- busybox-1.2.2.1/networking/dnsd.c 2006-10-24 15:21:17.000000000 -0500
  3. +++ busybox-1.2.2.1-patched/networking/dnsd.c 2007-04-12 12:49:53.000000000 -0500
  4. @@ -31,11 +31,11 @@
  5. #define is_daemon() (flags&16)
  6. #define is_verbose() (flags&32)
  7. -//#define DEBUG
  8. +#undef DEBUG
  9. enum {
  10. - MAX_HOST_LEN = 16, // longest host name allowed is 15
  11. + MAX_HOST_LEN = 41, // longest host name allowed is 40
  12. IP_STRING_LEN = 18, // .xxx.xxx.xxx.xxx\0
  13. //must be strlen('.in-addr.arpa') larger than IP_STRING_LEN
  14. @@ -229,19 +229,23 @@
  15. {
  16. int i;
  17. struct dns_entry *d = dnsentry;
  18. + char *p,*q;
  19. +
  20. + q = (char *)&(qs[1]);
  21. + p = &(d->name[1]);
  22. if(d) do {
  23. #ifdef DEBUG
  24. if(qs && d) {
  25. - char *p,*q;
  26. - q = (char *)&(qs[1]);
  27. - p = &(d->name[1]);
  28. fprintf(stderr, "\n%s: %d/%d p:%s q:%s %d",
  29. __FUNCTION__, strlen(p), (int)(d->name[0]),
  30. p, q, strlen(q));
  31. }
  32. #endif
  33. if (type == REQ_A) { /* search by host name */
  34. + p = &(d->name[1]);
  35. + if(strlen(q) != strlen(p))
  36. + continue;
  37. for(i = 1; i <= (int)(d->name[0]); i++)
  38. if(tolower(qs[i]) != d->name[i])
  39. break;
  40. @@ -398,13 +402,15 @@
  41. fprintf(stderr,"fileconf: %s\n", fileconf);
  42. }
  43. - if(is_daemon())
  44. + if(is_daemon()) {
  45. #ifdef BB_NOMMU
  46. /* reexec for vfork() do continue parent */
  47. vfork_daemon_rexec(1, 0, argc, argv, "-d");
  48. #else
  49. bb_xdaemon(1, 0);
  50. #endif
  51. + daemonmode = 1;
  52. + }
  53. dnsentryinit(is_verbose());