ca6afcea1e9631e31267797519a2ebc99a029e77
[packages.git] / ipv6 / aiccu / patches / 200-add_dn_skipname.patch
1 diff -Nru aiccu.old/common/dn_skipname.c aiccu/common/dn_skipname.c
2 --- aiccu.old/common/dn_skipname.c      1970-01-01 02:00:00.000000000 +0200
3 +++ aiccu/common/dn_skipname.c  2006-11-04 00:50:23.000000000 +0200
4 @@ -0,0 +1,51 @@
5 +#include <errno.h>
6 +#include <resolv.h>
7 +
8 +/* Ripped from glibc 2.4 sources. */
9 +
10 +/*
11 + * ns_name_skip(ptrptr, eom)
12 + *      Advance *ptrptr to skip over the compressed name it points at.
13 + * return:
14 + *      0 on success, -1 (with errno set) on failure.
15 + */
16 +int ns_name_skip(const u_char **ptrptr, const u_char *eom)
17 +{
18 +       const u_char *cp;
19 +       u_int n;
20 +
21 +       cp = *ptrptr;
22 +       while (cp < eom && (n = *cp++) != 0)
23 +       {
24 +               /* Check for indirection. */
25 +               switch (n & NS_CMPRSFLGS) {
26 +               case 0:                 /* normal case, n == len */
27 +                       cp += n;
28 +                       continue;
29 +               case NS_CMPRSFLGS:      /* indirection */
30 +                       cp++;
31 +                       break;
32 +               default:                /* illegal type */
33 +                       errno = EMSGSIZE;
34 +                       return (-1);
35 +               }
36 +               break;
37 +       }
38 +       if (cp > eom)
39 +       {
40 +               errno = EMSGSIZE;
41 +               return (-1);
42 +       }
43 +       *ptrptr = cp;
44 +       return (0);
45 +}
46 +
47 +int dn_skipname(const u_char *ptr, const u_char *eom)
48 +{
49 +       const u_char *saveptr = ptr;
50 +
51 +       if(ns_name_skip(&ptr, eom) == -1)
52 +               return (-1);
53 +       return (ptr - saveptr);
54 +}
55 +
56 diff -Nru aiccu.old/unix-console/Makefile aiccu/unix-console/Makefile
57 --- aiccu.old/unix-console/Makefile     2006-11-04 00:51:20.000000000 +0200
58 +++ aiccu/unix-console/Makefile 2006-11-04 00:48:51.000000000 +0200
59 @@ -10,9 +10,9 @@
60  #  $Date: 2006-07-25 09:20:48 $
61  # **********************************************************/
62  
63 -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
64 +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
65  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
66 -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
67 +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
68  
69  # New features not fully implemented and thus disabled for now
70  #CFLAGS        += -D NEWSTUFF_TSP -D NEWSTUFF_TEEPEE