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