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.

68 lines
2.4 KiB

  1. --- /dev/null
  2. +++ b/common/dn_skipname.c
  3. @@ -0,0 +1,51 @@
  4. +#include <errno.h>
  5. +#include <resolv.h>
  6. +
  7. +/* Ripped from glibc 2.4 sources. */
  8. +
  9. +/*
  10. + * ns_name_skip(ptrptr, eom)
  11. + * Advance *ptrptr to skip over the compressed name it points at.
  12. + * return:
  13. + * 0 on success, -1 (with errno set) on failure.
  14. + */
  15. +int ns_name_skip(const u_char **ptrptr, const u_char *eom)
  16. +{
  17. + const u_char *cp;
  18. + u_int n;
  19. +
  20. + cp = *ptrptr;
  21. + while (cp < eom && (n = *cp++) != 0)
  22. + {
  23. + /* Check for indirection. */
  24. + switch (n & NS_CMPRSFLGS) {
  25. + case 0: /* normal case, n == len */
  26. + cp += n;
  27. + continue;
  28. + case NS_CMPRSFLGS: /* indirection */
  29. + cp++;
  30. + break;
  31. + default: /* illegal type */
  32. + errno = EMSGSIZE;
  33. + return (-1);
  34. + }
  35. + break;
  36. + }
  37. + if (cp > eom)
  38. + {
  39. + errno = EMSGSIZE;
  40. + return (-1);
  41. + }
  42. + *ptrptr = cp;
  43. + return (0);
  44. +}
  45. +
  46. +int dn_skipname(const u_char *ptr, const u_char *eom)
  47. +{
  48. + const u_char *saveptr = ptr;
  49. +
  50. + if(ns_name_skip(&ptr, eom) == -1)
  51. + return (-1);
  52. + return (ptr - saveptr);
  53. +}
  54. +
  55. --- a/unix-console/Makefile
  56. +++ b/unix-console/Makefile
  57. @@ -10,9 +10,9 @@
  58. # $Date: 2007-01-15 11:04:27 $
  59. # **********************************************************/
  60. -SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c
  61. +SRCS = main.c ../common/tun.c ../common/aiccu.c ../common/hash_md5.c ../common/hash_sha1.c ../common/common.c ../common/heartbeat.c ../common/tic.c ../common/ayiya.c ../common/aiccu_test.c ../common/resolver.c ../common/dn_skipname.c
  62. INCS = ../common/tun.h ../common/aiccu.h ../common/hash_md5.h ../common/hash_sha1.h ../common/common.h ../common/heartbeat.h ../common/tic.h ../common/ayiya.h ../common/resolver.h
  63. -OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o
  64. +OBJS = main.o ../common/tun.o ../common/aiccu.o ../common/hash_md5.o ../common/hash_sha1.o ../common/common.o ../common/heartbeat.o ../common/tic.o ../common/ayiya.o ../common/aiccu_test.o ../common/resolver.o ../common/dn_skipname.o
  65. # New features not fully implemented and thus disabled for now
  66. #CFLAGS += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE