source: npl/overig/nstx/nstx_1.1-beta6-4.diff @ 892871d

Last change on this file since 892871d was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 24.2 KB
RevLine 
[c5c522c]1--- nstx-1.1-beta6.orig/Makefile
2+++ nstx-1.1-beta6/Makefile
3@@ -1,4 +1,4 @@
4-CFLAGS += -ggdb -Wall -Werror
5+CFLAGS += -ggdb -Wall -Werror -Wsign-compare
6 
7 NSTXD_SRCS = nstxd.c nstx_encode.c nstx_pstack.c nstx_dns.c nstx_tuntap.c nstx_queue.c
8 NSTXD_OBJS = ${NSTXD_SRCS:.c=.o}
9--- nstx-1.1-beta6.orig/nstx_dns.c
10+++ nstx-1.1-beta6/nstx_dns.c
11@@ -6,6 +6,7 @@
12 #include <fcntl.h>
13 #include <syslog.h>
14 #include <unistd.h>
15+#include <assert.h>
16 
17 #include "nstxfun.h"
18 #include "nstxdns.h"
19@@ -58,7 +59,7 @@
20  * DNS-packet 'msg'. */
21 
22 static char *
23-decompress_label(const char *msg, int msglen, const char *lbl)
24+decompress_label(const char *msg, unsigned int msglen, const char *lbl)
25 {
26    const char *ptr = lbl;
27    char *buf;
28@@ -69,7 +70,7 @@
29   
30    while ((chunklen = *ptr)) {
31       if (chunklen > 63) {
32-        if ((ptr-msg) >= (msglen-1)) {
33+        if ((ptr-msg) >= ((signed int)msglen-1)) {
34            DEBUG("Bad pointer at end of msg");
35            if (buf)
36              free(buf);
37@@ -104,13 +105,15 @@
38         ptr += chunklen + 1;
39       }
40    }
41-   buf[buflen] = 0;
42-   buflen++;
43+   if (buf) {
44+     buf[buflen] = 0;
45+     buflen++;
46+   }
47    return buf;
48 }
49 
50 static const unsigned char *
51-_cstringify(const unsigned char *data, int *dlen, int clen)
52+_cstringify(const unsigned char *data, int *dlen, unsigned int clen)
53 {
54    static unsigned char *buf;
55   
56@@ -143,7 +146,7 @@
57 {
58    int len;
59   
60-   len = strlen(data);
61+   len = strlen((char*)data);
62    return _cstringify(data, &len, 63);
63 }
64 
65@@ -183,24 +186,24 @@
66 static const unsigned char *
67 lbl2data (const unsigned char *data, size_t len)
68 {
69-   static unsigned char *buf;
70-   
71+   static signed char *buf = NULL;
72    const unsigned char *s = data;
73-   unsigned char *d;
74-   unsigned int llen;
75+   signed char *d;
76+   signed int llen;
77   
78    d = buf = realloc(buf, len);
79+   assert(d);
80    do
81      {
82        llen = *s++;
83-       if ((llen > 63) || (llen > len - (s - data)))
84-         return NULL;
85+       if ((llen > 63) || (llen > (signed int)(len - (s - data))))
86+         break;
87        memcpy(d, s, llen);
88        s += llen;
89        d += llen;
90      } while (llen);
91    *d = '\0';
92-   return buf;
93+   return (const unsigned char*)buf;
94 }
95 
96 /* New DNS-Code */
97@@ -318,7 +321,7 @@
98    const char *ptr;
99    static char *fqdn;
100   
101-   ptr = data2lbl(data);
102+   ptr = (char*)data2lbl((unsigned char*)data);
103    fqdn = realloc(fqdn, strlen(ptr)+strlen(suffix)+1);
104    strcpy(fqdn, ptr);
105    strcat(fqdn, suffix);
106@@ -336,8 +339,9 @@
107      free(buf);
108   
109    off = strstr(fqdn, suffix);
110-   if (off)
111-       buf = strdup(lbl2data(fqdn, off - fqdn));
112+   /* only parse if the fqdn was found, and there is more than the fqdn */
113+   if (off && off != fqdn)
114+       buf = strdup((char*)lbl2data((unsigned char*)fqdn, off - fqdn));
115    else
116        /* Our suffix not found... */
117        buf = NULL;
118@@ -364,7 +368,7 @@
119    const char *ptr;
120    char *buf;
121   
122-   ptr = data2txt(data, &len);
123+   ptr = (char*)data2txt((unsigned char*)data, &len);
124    buf = malloc(len);
125    memcpy(buf, ptr, len);
126   
127@@ -477,7 +481,7 @@
128      {
129        offsets[i++] = ptr - buf;
130        rrp = _new_listitem(&pkt->query);
131-       rrp->data = decompress_label(buf, len, ptr);
132+       rrp->data = decompress_label((char*)buf, len, (char*)ptr);
133        if (!rrp->data)
134          {
135             syslog(LOG_ERR, "dns_extractpkt: decompress_label choked in qd\n");
136@@ -517,8 +521,9 @@
137             if (j < i)
138               rrp->link = j;
139          }
140-       ptr = _skip_lbl(ptr, &remain);
141-       rrp->len = ptr[8]*256+ptr[9];
142+       //      ptr = _skip_lbl(ptr, &remain);
143+       //      rrp->len = ptr[8]*256+ptr[9];
144+       rrp->len = ptr[10]*256+ptr[11];
145        ptr += 12;
146        remain -= 12;
147        if (remain < rrp->len)
148--- nstx-1.1-beta6.orig/nstx_encode.c
149+++ nstx-1.1-beta6/nstx_encode.c
150@@ -30,11 +30,11 @@
151 
152 void init_revmap (void)
153 {
154-   int i;
155+   unsigned int i;
156   
157    revmap = malloc(256);
158   
159-   for (i = 0; i < strlen(map); i++)
160+   for (i = 0; i < strlen((char*)map); i++)
161      revmap[map[i]] = i;
162 }
163   
164@@ -70,11 +70,11 @@
165    if (!revmap)
166      init_revmap();
167   
168-   len = strlen(data)-1;
169-   
170+   len = strlen((char*)data);
171+
172    buf = realloc(buf, ((len+3)/4)*3);
173   
174-   while (off < len) {
175+   while (off+3 < len) {
176       buf[i+0] = (revmap[data[off]]<<2)|((revmap[data[off+1]]&48)>>4);
177       buf[i+1] = ((revmap[data[off+1]]&15)<<4)|((revmap[data[off+2]]&60)>>2);
178       buf[i+2] = ((revmap[data[off+2]]&3)<<6)|(revmap[data[off+3]]);
179--- nstx-1.1-beta6.orig/nstx_pstack.c
180+++ nstx-1.1-beta6/nstx_pstack.c
181@@ -49,7 +49,7 @@
182    char *netpacket;
183    int netpacketlen;
184   
185-   if ((!ptr) || len < sizeof(struct nstxhdr))
186+   if ((!ptr) || (signed int) len < (signed int) sizeof(struct nstxhdr))
187      return;
188 
189    if (!nstxpkt->id)
190--- nstx-1.1-beta6.orig/nstx_tuntap.c
191+++ nstx-1.1-beta6/nstx_tuntap.c
192@@ -215,7 +215,7 @@
193 
194 struct nstxmsg *nstx_select (int timeout)
195 {
196-   int peerlen;
197+   unsigned peerlen;
198    fd_set set;
199    struct timeval tv;
200    static struct nstxmsg *ret = NULL;
201--- nstx-1.1-beta6.orig/nstxcd.c
202+++ nstx-1.1-beta6/nstxcd.c
203@@ -63,7 +63,7 @@
204 int main (int argc, char * argv[]) {
205   struct nstxmsg *msg;
206   const char   *device = NULL;
207-  char          ch;
208+  int           ch;
209 
210   nsid = time(NULL);
211 
212@@ -110,11 +110,11 @@
213    const char *data;
214    int datalen;
215   
216-   pkt = dns_extractpkt (reply, len);
217+   pkt = dns_extractpkt ((unsigned char*)reply, len);
218    if (!pkt)
219      return;
220    while ((data = dns_getanswerdata(pkt, &datalen))) {
221-      data = txt2data(data, &datalen);
222+      data = (char*)txt2data((unsigned char*)data, &datalen);
223       nstx_handlepacket (data, datalen, &sendtun);
224    }
225    dequeueitem(pkt->id);
226@@ -159,9 +159,9 @@
227     data += l;
228     datalen -= l;
229     
230-    dns_addquery(pkt, dns_data2fqdn(nstx_encode(p, sizeof(nh)+l)));
231+    dns_addquery(pkt, dns_data2fqdn(nstx_encode((unsigned char*)p, sizeof(nh)+l)));
232     free(p);
233-    p = dns_constructpacket(pkt, &l);
234+    p = (char*)dns_constructpacket(pkt, &l);
235     sendns(p, l, NULL);
236     free(p);
237 
238--- nstx-1.1-beta6.orig/nstxd.c
239+++ nstx-1.1-beta6/nstxd.c
240@@ -67,7 +67,7 @@
241 }
242 
243 int main (int argc, char *argv[]) {
244-   char                 ch;
245+   signed char  ch;
246    const char  *device = NULL, *dir = NULL;
247    in_addr_t    bindto = INADDR_ANY;
248    uid_t        uid = 0;
249@@ -172,7 +172,7 @@
250    dns_setid(pkt, q->id);
251    dns_settype(pkt, DNS_RESPONSE);
252    dns_addanswer(pkt, "\xb4\x00\x00\x00", 4, dns_addquery(pkt, q->name));
253-   buf = dns_constructpacket (pkt, &len);
254+   buf = (char*)dns_constructpacket (pkt, &len);
255    sendns(buf, len, &q->peer);
256    free(buf);
257 } 
258@@ -188,7 +188,7 @@
259   
260    if (msg) {
261      if (msg->src == FROMNS) {
262-       pkt = dns_extractpkt(msg->data, msg->len);
263+       pkt = dns_extractpkt((unsigned char*)msg->data, msg->len);
264        if (pkt)
265          {
266             name = dns_getquerydata(pkt);
267@@ -198,7 +198,7 @@
268                        name);
269                  queueitem(pkt->id, name, &msg->peer);
270                  if ((data = dns_fqdn2data(name)) &&
271-                     (buf = nstx_decode(data, &len)))
272+                     (buf = nstx_decode((unsigned char*)data, &len)))
273                    {
274                       nstx_handlepacket(buf, len, &sendtun);
275                    }
276@@ -220,7 +220,7 @@
277       len = dns_getfreespace(pkt, DNS_RESPONSE);
278       buf = dequeue_senditem(&len);
279       dns_addanswer(pkt, buf, len, link);
280-      buf = dns_constructpacket(pkt, &len);
281+      buf = (char*)dns_constructpacket(pkt, &len);
282       sendns(buf, len, &qitem->peer);
283    }
284    timeoutqueue(do_timeout);
285--- nstx-1.1-beta6.orig/debian/nstx.postinst
286+++ nstx-1.1-beta6/debian/nstx.postinst
287@@ -0,0 +1,21 @@
288+#!/bin/sh
289+
290+set -e
291+
292+case "$1" in
293+    configure)
294+       adduser --quiet --system --home /var/run/nstxd nstxd
295+    ;;
296+
297+    abort-upgrade|abort-remove|abort-deconfigure)
298+
299+    ;;
300+
301+    *)
302+        echo "postinst called with unknown argument \`$1'" >&2
303+        exit 1
304+    ;;
305+esac
306+
307+#DEBHELPER#
308+
309--- nstx-1.1-beta6.orig/debian/changelog
310+++ nstx-1.1-beta6/debian/changelog
311@@ -0,0 +1,102 @@
312+nstx (1.1-beta6-4) unstable; urgency=low
313+
314+  * Fix segfault triggered by normal DNS traffic (closes: #345159)
315+
316+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Wed, 18 Jan 2006 21:10:26 +0000
317+
318+nstx (1.1-beta6-3) unstable; urgency=low
319+
320+  * Apply patch to fix crashes when looking up the tunnel domain
321+    (closes: #307489)
322+  * Allow the tunnel being brought up to be configured (closes: #334073)
323+  * Attempt to automatically grab a DNS server (closes: #307769)
324+  * Add NSTX_IFACE string in /etc/default/nstx to allow binding to a
325+    specific interface on nstxd startup (closes: #299435)
326+
327+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 12 Dec 2005 19:28:09 +0000
328+
329+nstx (1.1-beta6-2.1) unstable; urgency=high
330+
331+  * Non-maintainer upload.
332+  * nstxcd.c: changed the variable ch to be an int instead of a char, since
333+    that is what it must be when it gets the return value from getopt.
334+    Closes: #306265 (which is release critical, hence a high severity).
335+
336+ -- Lars Wirzenius <liw@iki.fi>  Thu, 28 Apr 2005 19:39:00 +0300
337+
338+nstx (1.1-beta6-2) unstable; urgency=low
339+
340+  * don't cast things to signed chars if you want numbers greater than 128
341+    (closes: #302874)
342+  * fix FTBFS with gcc 4.0 (thanks to Andreas Jochens for the patch)
343+    (closes: #300878)
344+  * don't assume chars are signed
345+
346+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Sun,  3 Apr 2005 16:36:20 +0100
347+
348+nstx (1.1-beta6-1) unstable; urgency=high
349+
350+  * new upstream release
351+  * allow binding to a specific interface (closes: #272850)
352+  * major stability improvements, upgrade recommended
353+
354+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon,  7 Mar 2005 01:52:10 +0000
355+
356+nstx (1.1-beta5-6) unstable; urgency=high
357+
358+  * initialise variables that are going to be used (closes: #277293)
359+  * compile with -W, fix up signed/unsigned comparisons (closes: #277296)
360+  * fix restart bug in nstxd init script (closes: #277319)
361+  * add a length check to nstx_decode, so we don't try to decode packets
362+    that are too short (closes: #277334)
363+  * bump the debhelper build-depends to reflect the requirement for --name
364+    in dh_installinit (closes: #277295)
365+       
366+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Tue, 19 Oct 2004 23:13:05 +0100
367+       
368+nstx (1.1-beta5-5) unstable; urgency=high
369+
370+  * Make sure that packet length is compared against a signed int, rather
371+    than an unsigned size_t. I haven't managed to track down what causes
372+    this in the first place, but nstxd sessions seem to crash with
373+    moderate regularity even when they're not being used. At a guess there's
374+    some sort of DNS probing going on that upsets it (closes: #259079)
375+
376+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 17 Aug 2004 18:20:05 +0100
377+       
378+nstx (1.1-beta5-4) unstable; urgency=low       
379+
380+  * Depend on adduser (closes: #263334)
381+       
382+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 19 Jul 2004 16:38:44 +0100
383+       
384+nstx (1.1-beta5-3) unstable; urgency=low
385+
386+  * Generate an unprivileged user. chroot and drop privileges on daemon
387+    startup.
388+  * Revert nstxcd code to 1.1-beta 4 - working with bind seems preferable
389+    to working with djbdns (closes: #259057)
390+
391+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Mon, 19 Jul 2004 16:38:44 +0100
392+       
393+nstx (1.1-beta5-2) unstable; urgency=low
394+
395+  * ifdown tun0 on stop
396+
397+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 10 Jul 2004 19:11:33 +0100
398+       
399+nstx (1.1-beta5-1) unstable; urgency=low
400+       
401+  * New upstream version
402+  * Compile with -O2 (Closes: #255143)
403+  * Don't claim to have failed when startup is disabled
404+  * Fix segfault on zero-length queries
405+       
406+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Sat, 10 Jul 2004 18:37:43 +0100
407+       
408+nstx (1.1-beta4-1) unstable; urgency=low
409+
410+  * Initial Release.
411+
412+ -- Matthew Garrett <mjg59@srcf.ucam.org>  Thu, 27 May 2004 16:41:12 +0100
413+
414--- nstx-1.1-beta6.orig/debian/compat
415+++ nstx-1.1-beta6/debian/compat
416@@ -0,0 +1 @@
417+4
418--- nstx-1.1-beta6.orig/debian/dirs
419+++ nstx-1.1-beta6/debian/dirs
420@@ -0,0 +1,2 @@
421+usr/bin
422+usr/sbin
423--- nstx-1.1-beta6.orig/debian/nstx.nstxd.init
424+++ nstx-1.1-beta6/debian/nstx.nstxd.init
425@@ -0,0 +1,108 @@
426+#! /bin/sh
427+#
428+# /etc/init.d/nstxd: start and stop the nstx IP over DNS daemon
429+
430+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
431+DAEMON=/usr/sbin/nstxd
432+NAME=nstxd
433+DESC=nstxd
434+NSTX_OPTIONS="-C /var/run/nstxd -u nstxd"
435+
436+test -x $DAEMON || exit 0
437+
438+# Include nstx defaults if available
439+if [ -f /etc/default/nstx ] ; then
440+       . /etc/default/nstx
441+fi
442+
443+set -e
444+
445+check_start_nstxd_option() {
446+    if [ ! "$start_nstxd" = "yes" ]; then
447+       echo "Not starting nstx daemon, disabled via /etc/default/nstx"
448+       return 1
449+    else
450+       return 0
451+    fi
452+}
453+
454+
455+case "$1" in
456+  start)
457+  if check_start_nstxd_option; then
458+       echo -n "Starting $DESC: "
459+       if [ -n "$NSTX_IFACE" ]; then
460+               OPTIONS="-i $NSTX_IFACE $NSTX_OPTIONS $NSTX_DOMAIN"
461+       else
462+               OPTIONS="$NSTX_OPTIONS $NSTX_DOMAIN"
463+       fi
464+       start-stop-daemon --start -b -m --quiet --pidfile /var/run/$NAME.pid \
465+               --exec $DAEMON -- $OPTIONS
466+       sleep 1;
467+       if [ -n "$ifup_tun" ]; then
468+           ifup "$ifup_tun"
469+       fi
470+       # for backward compatibility
471+       if [ "$ifup_tun0" = "yes" ]; then
472+           ifup tun0
473+       fi
474+       echo "$NAME."
475+  else
476+      RET=1
477+  fi
478+       ;;
479+  stop)
480+       echo -n "Stopping $DESC: "
481+       if [ -n "$ifup_tun" ]; then
482+           ifdown "$ifup_tun"
483+       fi
484+       # for backward compatibility
485+       if [ "$ifup_tun0" = "yes" ]; then
486+           ifdown tun0
487+       fi
488+       start-stop-daemon --stop --quiet -m -o --pidfile /var/run/$NAME.pid \
489+               --exec $DAEMON
490+       echo "$NAME."
491+       ;;
492+  restart|force-reload)
493+       #
494+       #       If the "reload" option is implemented, move the "force-reload"
495+       #       option to the "reload" entry above. If not, "force-reload" is
496+       #       just the same as "restart".
497+       #
498+       echo -n "Restarting $DESC: "
499+       if [ -n "$ifup_tun" ]; then
500+           ifdown "$ifup_tun"
501+       fi
502+       # for backward compatibility
503+       if [ "$ifup_tun0" = "yes" ]; then
504+           ifdown tun0
505+       fi
506+       start-stop-daemon --stop -m -o --quiet --pidfile \
507+               /var/run/$NAME.pid --exec $DAEMON
508+       sleep 1
509+       if check_start_nstxd_option; then
510+           start-stop-daemon --start -b -m --quiet --pidfile \
511+               /var/run/$NAME.pid --exec $DAEMON -- $NSTX_OPTIONS $NSTX_DOMAIN
512+           sleep 1;
513+            if [ -n "$ifup_tun" ]; then
514+                ifup "$ifup_tun"
515+            fi
516+            # for backward compatibility
517+           if [ "$ifup_tun0" = "yes" ]; then
518+               ifup tun0
519+           fi
520+           echo "$NAME."
521+       else
522+           RET=1
523+       fi
524+       ;;
525+  *)
526+       N=/etc/init.d/$NAME
527+       # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
528+       echo "Usage: $N {start|stop|restart|force-reload}" >&2
529+       exit 1
530+       ;;
531+esac
532+
533+exit 0
534--- nstx-1.1-beta6.orig/debian/nstx.nstxcd.init
535+++ nstx-1.1-beta6/debian/nstx.nstxcd.init
536@@ -0,0 +1,102 @@
537+#! /bin/sh
538+#
539+# /etc/init.d/nstxcd: start and stop the nstx IP over DNS client
540+
541+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
542+DAEMON=/usr/sbin/nstxcd
543+NAME=nstxcd
544+DESC=nstxcd
545+
546+test -x $DAEMON || exit 0
547+
548+# Include nstx defaults if available
549+if [ -f /etc/default/nstx ] ; then
550+       . /etc/default/nstx
551+fi
552+
553+set -e
554+
555+check_start_nstxcd_option() {
556+    if [ ! "$start_nstxcd" = "yes" ]; then
557+       echo "Not starting nstx client, disabled via /etc/default/nstx"
558+       return 1
559+    else
560+       return 0
561+    fi
562+}
563+
564+
565+case "$1" in
566+  start)
567+  if check_start_nstxcd_option; then
568+       echo -n "Starting $DESC: "
569+       start-stop-daemon --start -b -m --quiet --pidfile /var/run/$NAME.pid \
570+               --exec $DAEMON -- $NSTX_DOMAIN $NSTX_DNS_SERVER
571+       sleep 1;
572+       if [ -n "$ifup_tun" ]; then
573+           ifup "$ifup_tun"
574+       fi
575+       # for backward compatibility
576+       if [ "$ifup_tun0" = "yes" ]; then
577+           ifup tun0
578+       fi
579+       echo "$NAME."
580+  else
581+      RET=1
582+  fi
583+       ;;
584+  stop)
585+       echo -n "Stopping $DESC: "
586+       if [ -n "$ifup_tun" ]; then
587+           ifdown "$ifup_tun"
588+       fi
589+       # for backward compatibility
590+       if [ "$ifup_tun0" = "yes" ]; then
591+           ifdown tun0
592+       fi
593+       start-stop-daemon --stop -m -o --quiet --pidfile /var/run/$NAME.pid \
594+               --exec $DAEMON
595+       echo "$NAME."
596+       ;;
597+  restart|force-reload)
598+       #
599+       #       If the "reload" option is implemented, move the "force-reload"
600+       #       option to the "reload" entry above. If not, "force-reload" is
601+       #       just the same as "restart".
602+       #
603+       echo -n "Restarting $DESC: "
604+       if [ -n "$ifup_tun" ]; then
605+           ifdown "$ifup_tun"
606+       fi
607+       # for backward compatibility
608+       if [ "$ifup_tun0" = "yes" ]; then
609+           ifdown tun0
610+       fi
611+       start-stop-daemon --stop -m -o --quiet --pidfile \
612+               /var/run/$NAME.pid --exec $DAEMON
613+       sleep 1
614+       if check_start_nstxcd_option; then
615+           start-stop-daemon --start -b -m --quiet --pidfile \
616+               /var/run/$NAME.pid --exec $DAEMON -- $NSTX_DOMAIN $NSTX_DNS_SERVER
617+           sleep 1;
618+            if [ -n "$ifup_tun" ]; then
619+                ifup "$ifup_tun"
620+            fi
621+            # for backward compatibility
622+           if [ "$ifup_tun0" = "yes" ]; then
623+               ifup tun0
624+           fi
625+           echo "$NAME."
626+       else
627+           RET=1
628+       fi
629+       ;;
630+  *)
631+       N=/etc/init.d/$NAME
632+       # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
633+       echo "Usage: $N {start|stop|restart|force-reload}" >&2
634+       exit 1
635+       ;;
636+esac
637+
638+exit 0
639--- nstx-1.1-beta6.orig/debian/control
640+++ nstx-1.1-beta6/debian/control
641@@ -0,0 +1,13 @@
642+Source: nstx
643+Section: net
644+Priority: optional
645+Maintainer: Matthew Garrett <mjg59@srcf.ucam.org>
646+Build-Depends: debhelper (>= 4.1.68)
647+Standards-Version: 3.6.0
648+
649+Package: nstx
650+Architecture: any
651+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
652+Description: Tunnel IP over DNS
653+ nstx allows you to pass IP packets via DNS queries. This allows you to use
654+ standard network protocols when otherwise only DNS would be available.
655--- nstx-1.1-beta6.orig/debian/rules
656+++ nstx-1.1-beta6/debian/rules
657@@ -0,0 +1,100 @@
658+#!/usr/bin/make -f
659+# -*- makefile -*-
660+# Sample debian/rules that uses debhelper.
661+# GNU copyright 1997 to 1999 by Joey Hess.
662+
663+# Uncomment this to turn on verbose mode.
664+#export DH_VERBOSE=1
665+
666+
667+
668+
669+CFLAGS = -Wall -g
670+
671+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
672+       CFLAGS += -O0
673+else
674+       CFLAGS += -O2
675+endif
676+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
677+       INSTALL_PROGRAM += -s
678+endif
679+
680+configure: configure-stamp
681+configure-stamp:
682+       dh_testdir
683+       # Add here commands to configure the package.
684+
685+       touch configure-stamp
686+
687+
688+build: build-stamp
689+
690+build-stamp: configure-stamp
691+       dh_testdir
692+
693+       # Add here commands to compile the package.
694+       $(MAKE)
695+       #/usr/bin/docbook-to-man debian/nstx.sgml > nstx.1
696+
697+       touch build-stamp
698+
699+clean:
700+       dh_testdir
701+       dh_testroot
702+       rm -f build-stamp configure-stamp
703+
704+       # Add here commands to clean up after the build process.
705+       -$(MAKE) clean
706+
707+       dh_clean
708+
709+install: build
710+       dh_testdir
711+       dh_testroot
712+       dh_clean -k
713+       dh_installdirs
714+
715+       # Add here commands to install the package into debian/nstx.
716+       install nstxd -D $(CURDIR)/debian/nstx/usr/sbin/nstxd
717+       install nstxcd -D $(CURDIR)/debian/nstx/usr/sbin/nstxcd
718+
719+# Build architecture-independent files here.
720+binary-indep: build install
721+# We have nothing to do by default.
722+
723+# Build architecture-dependent files here.
724+binary-arch: build install
725+       dh_testdir
726+       dh_testroot
727+       dh_installchangelogs Changelog
728+       dh_installdocs
729+       dh_installexamples
730+#      dh_install
731+#      dh_installmenu
732+#      dh_installdebconf       
733+#      dh_installlogrotate
734+#      dh_installemacsen
735+#      dh_installpam
736+#      dh_installmime
737+       dh_installinit
738+       dh_installinit --name=nstxd
739+       dh_installinit --name=nstxcd
740+#      dh_installcron
741+#      dh_installinfo
742+       dh_installman
743+       dh_link
744+       dh_strip
745+       dh_compress
746+       dh_fixperms
747+#      dh_perl
748+#      dh_python
749+#      dh_makeshlibs
750+       dh_installdeb
751+       dh_shlibdeps
752+       dh_gencontrol
753+       dh_md5sums
754+       dh_builddeb
755+
756+binary: binary-indep binary-arch
757+.PHONY: build clean binary-indep binary-arch binary install configure
758--- nstx-1.1-beta6.orig/debian/nstx.manpages
759+++ nstx-1.1-beta6/debian/nstx.manpages
760@@ -0,0 +1,2 @@
761+nstxd.8
762+nstxcd.8
763--- nstx-1.1-beta6.orig/debian/README.Debian
764+++ nstx-1.1-beta6/debian/README.Debian
765@@ -0,0 +1,43 @@
766+nstx for Debian
767+---------------
768+
769+This package requires the tun driver to be loaded. As a result, you need
770+CONFIG_TUN to be either y or m in your kernel configuration. In order to
771+start things automatically, you need to configure /etc/default/nstx
772+
773+Security note
774+-------------
775+
776+nstx includes no authentication. Anyone who knows the name of your tunnel
777+domain will be able to connect to the daemon.
778+
779+djbdns
780+------
781+
782+nstx will allegedly not work with a djbdns server. If you want to try
783+it, the following patch should make it work:
784+
785+--- nstx_dns.old.c     2004-08-17 18:13:26.000000000 +0100
786++++ nstx_dns.c 2004-08-17 18:13:12.000000000 +0100
787+@@ -598,9 +598,8 @@
788+            if (j < i)
789+              rrp->link = j;
790+         }
791+-      //      ptr = _skip_lbl(ptr, &remain);
792+-      //      rrp->len = ptr[8]*256+ptr[9];
793+-        rrp->len = ptr[10]*256+ptr[11];
794++      ptr = _skip_lbl(ptr, &remain);
795++      rrp->len = ptr[8]*256+ptr[9];
796+       ptr += 12;
797+       remain -= 12;
798+       if (remain < rrp->len)
799+
800+It's not included by default because it appears to break the nstx
801+client with bind9 servers. To apply it:
802+
803+apt-get source nstx
804+cd nstx-*
805+patch <debian/README.Debian
806+dpkg-buildpackage -rfakeroot
807+
808+ -- Matthew Garrett <mjg59@srcf.ucam.org>, Thu, 27 May 2004 16:41:12 +0100
809--- nstx-1.1-beta6.orig/debian/nstx.default
810+++ nstx-1.1-beta6/debian/nstx.default
811@@ -0,0 +1,25 @@
812+# Defaults for nstx initscript
813+# sourced by /etc/init.d/nstx
814+# installed at /etc/default/nstx by the maintainer scripts
815+
816+#
817+# This is a POSIX shell fragment
818+#
819+
820+# The name of the domain for the tunnel - needed for client and server
821+NSTX_DOMAIN=""
822+
823+# The IP address of the DNS server - needed for client only
824+NSTX_DNS_SERVER=`grep nameserver /etc/resolv.conf |head -1|awk '{print $2}'`
825+
826+# uncomment to start nstxd on system startup
827+#start_nstxd=yes
828+
829+# uncomment to start nstxcd on system startup
830+#start_nstxcd=yes
831+
832+# uncomment to bring up tun0 automatically
833+#ifup_tun=tun0
834+
835+# uncomment to tell nstx to bind to a specific interface
836+#NSTX_IFACE="1.2.3.4"
837--- nstx-1.1-beta6.orig/debian/copyright
838+++ nstx-1.1-beta6/debian/copyright
839@@ -0,0 +1,18 @@
840+This package was debianized by Matthew Garrett <mjg59@srcf.ucam.org> on
841+Thu, 27 May 2004 16:41:12 +0100.
842+
843+It was downloaded from http://nstx.dereference.de/nstx/
844+
845+Upstream Authors:
846+
847+Florian Heinz <sky@sysv.de>
848+Julien Oster <frodo@sysv.de>
849+
850+
851+Copyright:
852+
853+nstx is released under the terms of the GNU General Public License version 2
854+
855+On Debian systems, the complete text of the GNU General Public
856+License can be found in the file '/usr/share/common-licenses/GPL'
857+
858--- nstx-1.1-beta6.orig/debian/docs
859+++ nstx-1.1-beta6/debian/docs
860@@ -0,0 +1 @@
861+README
862--- nstx-1.1-beta6.orig/nstxcd.8
863+++ nstx-1.1-beta6/nstxcd.8
864@@ -0,0 +1,36 @@
865+.TH NSTXCD "8" "May 2004" "nstx 1.1-beta4" "User Commands"
866+.SH NAME
867+nstxcd \- IP over DNS tunneling client
868+
869+.SH SYNOPSIS
870+.B "nstxcd \fIDOMAIN\fR \fIIPADDRESS\fR"
871+
872+.SH DESCRIPTION
873+.B nstxcd
874+tunnels IP packets over DNS, allowing them to be sent to a server without
875+any protocols other than DNS being used.
876+
877+.SH OPTIONS
878+.B nstxcd
879+takes the following options:
880+.IP "domain"
881+The domain that nstxcd will send requests to. This domain must be delegated
882+to a machine that is running nstxd.
883+.IP "IP address"
884+The IP address of a DNS server that can be reached from the current machine.
885+
886+.SH USAGE
887+.Bnstxcd
888+should be run against a domain that has been delegated to a machine running
889+nstxd. It will then take any packets that are sent to the tun0 interface and
890+send them over DNS to the other tunnel endpoint. Responses will appear on
891+the tun0 interface.
892+
893+.SH AUTHORS
894+
895+.IP
896+Florian Heinz <sky@sysv.de>
897+.IP
898+Julien Oster <frodo@sysv.de>
899+.IP
900+http://nstx.dereference.de/nstx/
901--- nstx-1.1-beta6.orig/nstxd.8
902+++ nstx-1.1-beta6/nstxd.8
903@@ -0,0 +1,47 @@
904+.TH NSTXD "7" "Mar 2005" "nstx 1.1-beta6" "User Commands"
905+.SH NAME
906+nstxd \- IP over DNS tunneling daemon
907+
908+.SH SYNOPSIS
909+.B "nstxd \fIOPTION\fR \fIDOMAIN\fR"
910+
911+.SH DESCRIPTION
912+.B nstxd
913+listens for well formed DNS requests and translates them into IP packets.
914+Responses are sent in the form of DNS replies. This allows clients to
915+tunnel IP packets over the DNS protocol.
916+
917+.SH OPTIONS
918+.B nstxd
919+takes the following option:
920+.IP \-d tun-device
921+Use this tun device instead of tun0
922+.IP \-i ipaddr
923+Bind to this IP address rather than every available address
924+.IP \-C dir
925+Chroot to this directory on startup
926+.IP \-D
927+Daemonize on startup
928+.IP \-g
929+Switch on debug messages
930+.IP \-u user
931+Run as the following user
932+.IP "domain"
933+The domain that nstxd will listen to requests for. This should be a domain
934+that is delegated to the machine running nstxd.
935+
936+.SH USAGE
937+A domain should be delegated to the machine that will run nstxd. nstxd should
938+then be run giving that domain as the only argument. nstxd will then listen
939+for requests and translate them into IP packets that will appear on the tun0
940+interface. Packets sent to the tun0 interface will be transferred back to
941+the client as DNS answers.
942+
943+.SH AUTHORS
944+
945+.IP
946+Florian Heinz <sky@sysv.de>
947+.IP
948+Julien Oster <frodo@sysv.de>
949+.IP
950+http://nstx.dereference.de/nstx/
Note: See TracBrowser for help on using the repository browser.