Package: vtun
Version: 3.0.2-2.1
Severity: serious
Tags: patch
Justification: Policy 9.3.2
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu maverick ubuntu-patch

Hi, in Ubuntu, we've applied the attached patch to achieve the following:

  * Merge from debian unstable (LP: #598053), remaining changes:
    - Clean up debian directory.
    - debian/control:
      + Added ${misc:Depends}. 
    - debian/patches/07-fix-gcc-warnings.patch: Fix gcc warnings.
    - debian/rules: Dont start vtun when there is nothing to start. 
      (LP: #420545)
    - debian/init.d: 
      + implemented status.
      + Create /var/lock/vtund directory. (LP: #571415)
  * Dropped changes:
    - Clean up debian directory: broken comment, it does not explain what 
      has been clean.

We thought you may be interested.  Some of those issues are pretty
small, and the gcc-warnings patch looks just hides bugs, but the init
script status feature would probably be useful to Debian.

In particular, the /var/lock on tmpfs fix should be applied in Debian.

SR

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_ZA.UTF-8, LC_CTYPE=en_ZA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
Stefano Rivera
  http://tumbleweed.org.za/
  H: +27 21 465 6908 C: +27 72 419 8559  UCT: x3127
diff -u vtun-3.0.2/debian/control vtun-3.0.2/debian/control
--- vtun-3.0.2/debian/control
+++ vtun-3.0.2/debian/control
@@ -10,7 +11,7 @@
 
 Package: vtun
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: virtual tunnel over TCP/IP networks
  VTun is the easiest way to create virtual tunnels over TCP/IP networks
  with traffic shaping and compression.
diff -u vtun-3.0.2/debian/init.d vtun-3.0.2/debian/init.d
--- vtun-3.0.2/debian/init.d
+++ vtun-3.0.2/debian/init.d
@@ -28,6 +28,8 @@
         . /etc/default/$NAME
 fi
 
+mkdir -p /var/lock/vtund
+
 case "$1" in
     start)
         if [ -f /etc/vtund-start.conf ]; then
@@ -73,6 +75,13 @@
             rm -f $i
         done
         ;;
+    status)
+    for i in 0 1 2 3 4 5 6 7 8 9; do
+        eval name=\$CLIENT${i}_NAME
+        eval host=\$CLIENT${i}_HOST
+        status_of_proc -p $PIDPREFIX.$name-$host.pid $DAEMON vtund && e$
+    done
+    ;;
     reload|force-reload)
         echo "Reloading vtund.";
         for i in $PIDPREFIX*.pid; do
@@ -86,7 +95,7 @@
         $0 start
         ;;
     *)
-        echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
+        echo "Usage: $0 {start|stop|restart|reload|status|force-reload}" >&2
         exit 1
         ;;
 esac
diff -u vtun-3.0.2/debian/rules vtun-3.0.2/debian/rules
--- vtun-3.0.2/debian/rules
+++ vtun-3.0.2/debian/rules
@@ -78,7 +78,7 @@
 	dh_installexamples
 	dh_install
 	dh_installlogrotate
-	dh_installinit --no-restart-on-upgrade
+	dh_installinit --no-start
 	dh_installman
 	dh_link
 	dh_strip
diff -u vtun-3.0.2/debian/patches/series vtun-3.0.2/debian/patches/series
--- vtun-3.0.2/debian/patches/series
+++ vtun-3.0.2/debian/patches/series
@@ -7,0 +8 @@
+07-fix-gcc-warnings.patch
only in patch2:
unchanged:
--- vtun-3.0.2.orig/debian/patches/07-fix-gcc-warnings.patch
+++ vtun-3.0.2/debian/patches/07-fix-gcc-warnings.patch
@@ -0,0 +1,57 @@
+diff -Naurp vtun-3.0.2.orig/main.c vtun-3.0.2/main.c
+--- vtun-3.0.2.orig/main.c	2008-01-07 17:35:53.000000000 -0500
++++ vtun-3.0.2/main.c	2009-08-14 13:00:19.000000000 -0400
+@@ -53,6 +53,7 @@ extern char *optarg;
+ int main(int argc, char *argv[], char *env[])
+ {
+      int svr, daemon, sock, dofork, fd, opt;
++     int ret;
+      struct vtun_host *host = NULL;
+      struct sigaction sa;
+      char *hst;
+@@ -175,14 +176,14 @@ int main(int argc, char *argv[], char *e
+ 
+         /* Direct stdin,stdout,stderr to '/dev/null' */
+         fd = open("/dev/null", O_RDWR);
+-	close(0); dup(fd);
+-	close(1); dup(fd);
+-        close(2); dup(fd);
++	close(0); ret = dup(fd);
++	close(1); ret = dup(fd);
++        close(2); ret = dup(fd);
+         close(fd);
+ 
+ 	setsid();
+ 
+-	chdir("/");
++	ret = chdir("/");
+      }
+ 
+      if(svr){
+diff -Naurp vtun-3.0.2.orig/tunnel.c vtun-3.0.2/tunnel.c
+--- vtun-3.0.2.orig/tunnel.c	2008-01-07 17:36:03.000000000 -0500
++++ vtun-3.0.2/tunnel.c	2009-08-14 13:02:23.000000000 -0400
+@@ -71,6 +71,7 @@ int (*proto_read)(int fd, char *buf);
+ int tunnel(struct vtun_host *host)
+ {
+      int null_fd, pid, opt;
++     int ret;
+      int fd[2]={-1, -1};
+      char dev[VTUN_DEV_LEN]="";
+      int interface_already_open = 0;
+@@ -168,12 +169,12 @@ int tunnel(struct vtun_host *host)
+ 	         case VTUN_PIPE:
+ 		    null_fd = open("/dev/null", O_RDWR);
+ 		    close(fd[0]);
+-		    close(0); dup(fd[1]);
+-		    close(1); dup(fd[1]);
++		    close(0); ret = dup(fd[1]);
++		    close(1); ret = dup(fd[1]);
+ 		    close(fd[1]);
+ 
+ 		    /* Route stderr to /dev/null */
+-		    close(2); dup(null_fd);
++		    close(2); ret = dup(null_fd);
+ 		    close(null_fd);
+ 		    break;
+ 	         case VTUN_ETHER:

Reply via email to