aboutsummaryrefslogtreecommitdiff
path: root/package/vtun/vtun.patch
blob: 00a12454eee40aafb39764f1258349564065ddf1 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
diff -urN vtun/Makefile.in vtun-2.6/Makefile.in
--- vtun/Makefile.in	2002-12-20 09:55:47.000000000 -0700
+++ vtun-2.6/Makefile.in	2003-06-05 12:38:31.000000000 -0600
@@ -28,7 +28,7 @@
 LEXFLAGS = -t 
 
 INSTALL = @INSTALL@
-INSTALL_OWNER = -o root -g 0
+INSTALL_OWNER =
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
@@ -86,15 +86,15 @@
 
 install_config: 
 	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(ETC_DIR)
-	if [ ! -f $(ETC_DIR)/vtund.conf ]; then \
-	  $(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR); \
-	fi
+	$(INSTALL) -m 600 $(INSTALL_OWNER) vtund.conf $(DESTDIR)$(ETC_DIR);
+	$(INSTALL) -m 600 $(INSTALL_OWNER) scripts/vtund-start.conf $(DESTDIR)$(ETC_DIR);
 
 install: vtund install_config install_man
-	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(VAR_DIR)/run
 	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(STAT_DIR)
 	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(LOCK_DIR)
 	$(INSTALL) -d -m 755 $(INSTALL_OWNER) $(DESTDIR)$(SBIN_DIR)
 	$(INSTALL) -m 755 $(INSTALL_OWNER) vtund $(DESTDIR)$(SBIN_DIR)
+	$(INSTALL) -m 755 $(INSTALL_OWNER) scripts/vtund.rc.debian \
+		$(DESTDIR)$(ETC_DIR)/init.d/S90vtun
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
diff -urN vtun/scripts/vtund.rc.debian vtun-2.6/scripts/vtund.rc.debian
--- vtun/scripts/vtund.rc.debian	2000-03-26 10:06:37.000000000 -0700
+++ vtun-2.6/scripts/vtund.rc.debian	2003-06-05 12:38:46.000000000 -0600
@@ -1,92 +1,48 @@
-#! /usr/bin/perl -w
+#! /bin/sh
+#
 
-### vtund-start
-###
-### script to start vtund as either a server or a client, according to
-### the config file /etc/vtund-start.conf
-###
-### Copyright 1999 Craig Sanders <cas@taz.net.au>
-###
-### Written for the Debian GNU/Linux distribution.  This script is free
-### software licensed under the terms of the GNU General Public License.
-
-$DAEMON="/usr/sbin/vtund" ;
-
-$do_what = shift ;
-$args="start|stop|reload|force-reload|restart" ;
-if ( $do_what !~ /^($args)$/i ) {
-    print "Usage: /etc/init.d/vtun {$args}\n" ;
-        exit 0 ;
-}
-
-$SSD="/sbin/start-stop-daemon" ;
-$SSDARGS="--verbose --exec $DAEMON" ;
-
-$sconf="/etc/vtund-start.conf" ;
-open(SCONF,"<$sconf") || die "couldn't open $sconf: $!\n" ;
-while (<SCONF>) {
-        chomp ;
-        s/#.*//;
-        s/^ +| +$//;
-        next if (/^$/) ;
-
-        @line = split ;
-        $host = shift(@line) ;
-        $server = shift(@line) ;
-        $args = "" ;
-        foreach (@line) { $args .= " $_" } ;
-
-        $host='' if ($host =~ /--server--/i ) ;
-
-        if ( $do_what eq 'start' ) {
-                &start($host,$server,$args) ;
-        } elsif ( $do_what eq 'stop' ) {
-                &stop($host,$server,$args) ;
-        } elsif ( $do_what eq 'restart' ) {
-                &stop($pidfile) ;
-                &start($host,$server,$args) ;
-        } elsif ( $do_what =~ /^(reload|force-reload)$/ ) {
-                &reload($host,$server) ;
-        }
-}
-close (SCONF);
-
-
-sub start {
-        my($host,$server,$args) = @_ ;
-    print "  Starting vtun " ;
-        if ($host eq '') {
-                print "server\n" ;
-        system "$SSD --start $SSDARGS -- $args -s -P $server" ;
-        } else {
-                print "client $host to $server\n" ;
-                $pidfile="/var/run/vtun.$host.$server" ;
-        system "$SSD --start $SSDARGS --pidfile $pidfile -- $args $host $server" ;
-        }
-} ;
-
-sub stop {
-        my($host,$server,$args) = @_ ;
-    print "  Stopping vtun " ;
-        if ($host eq '') {
-                print "server\n" ;
-        system "$SSD --stop $SSDARGS" ;
-        } else {
-                print "client $host to $server\n" ;
-                $pidfile="/var/run/vtun.$host.$server" ;
-        system "$SSD --stop $SSDARGS --pidfile $pidfile" ;
-        }
-} ;
-
-sub reload {
-        my($host,$server) = @_ ;
-    print "  Reloading vtun " ;
-        if ($host eq '') {
-                print "server\n" ;
-        system "$SSD --stop $SSDARGS --signal 1" ;
-        } else {
-                print "client $host to $server\n" ;
-                $pidfile="/var/run/vtun.$host.$server" ;
-        system "$SSD --stop $SSDARGS --signal 1 --pidfile $pidfile" ;
-        }
-}
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DAEMON=/usr/sbin/vtund
+CONFFILE=/etc/vtund-start.conf
+PIDPREFIX=/var/run/vtund
+  
+test -f $DAEMON || exit 0
+  
+case "$1" in 
+       start)
+      # find all the defined tunnels
+      egrep -v '^[:space:]*(#.*)?$' $CONFFILE | while true;
+      do
+          read i
+          # no more lines available? done, then.
+          if [ $? != 0 ] ; then break; fi
+              SARGS=`echo $i|sed -ne 's/--server--\s*/-s -P /p'`;
+              if [ -n "$SARGS" ];
+              then
+                 echo "Starting vtund server."
+                  start-stop-daemon -S -x $DAEMON -- $SARGS;
+              else
+                  # split args into host and rest
+                  HOST=`echo $i|cut -f 1 -d " "`;
+                  TARGET=`echo $i|cut -f 2 -d " "`;
+                  echo  "Starting vtund client $HOST to $TARGET.";
+                  start-stop-daemon -S -x $DAEMON -- $i;
+              fi
+          done
+              ;;
+       stop) 
+	   echo "Stopping vtund.";
+	   start-stop-daemon -K -x vtund;
+	   ;;
+
+       restart|reload|force-reload) 
+	   $0 stop
+	   sleep 1;
+	   $0 start
+	   ;;
+   *)
+      echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
+       exit 1
+               ;;
+esac
+exit 0
--- vtun-2.6/configure.dist	2004-03-11 10:39:10.000000000 -0600
+++ vtun-2.6/configure	2004-03-11 10:45:52.000000000 -0600
@@ -2112,7 +2112,7 @@
     echo $ac_n "checking "for blowfish.h"""... $ac_c" 1>&6
 echo "configure:2114: checking "for blowfish.h"" >&5 
     ac_hdr_found=no
-    for p in $BLOWFISH_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include  /usr/include/crypto; do
+    for p in $BLOWFISH_HDR_DIR $SSL_HDR_DIR /usr/include/ssl /usr/include/openssl /usr/include /usr/local/include /usr/local/ssl/include  /usr/include/crypto; do
 	if test -n "$p"; then
 	  dir="$p"
 	else