Package: vtun
Version: 3.0.1-2
Severity: normal

Vtun uses old LEGACY PTY if serial line is used (profile viper for example). In 
debian kernel LEGACY PTY is disabled.

I made a patch for use unix 98 pts which is now used.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-2-686 (SMP w/2 CPU cores)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages vtun depends on:
ii  debconf [debconf-2.0]   1.5.17           Debian configuration management sy
ii  libc6                   2.7-0exp8        GNU C Library: Shared libraries
ii  liblzo2-2               2.02-3           data compression library
ii  libssl0.9.8             0.9.8g-3         SSL shared libraries
ii  zlib1g                  1:1.2.3.3.dfsg-7 compression library - runtime

vtun recommends no packages.

-- debconf-show failed
diff -urN vtun-3.0.1/generic/pty_dev.c vtun-3.0.1_patched_pts/generic/pty_dev.c
--- vtun-3.0.1/generic/pty_dev.c	2006-12-11 07:55:06.000000000 +0000
+++ vtun-3.0.1_patched_pts/generic/pty_dev.c	2007-11-19 10:50:57.893581923 +0000
@@ -29,6 +29,8 @@
 #include <string.h>
 #include <syslog.h>
 
+#include <pty.h>
+
 #include "vtun.h"
 #include "lib.h"
 
@@ -55,31 +57,29 @@
 
 #else
 
-    char ptyname[] = "/dev/ptyXY";
-    char ch[] = "pqrstuvwxyz";
-    char digit[] = "0123456789abcdefghijklmnopqrstuv";
+    char *ptyname;
     int  l, m;
+    int master, slave;
 
-    /* This algorithm should work for almost all standard Unices */	
-    for(l=0; ch[l]; l++ ) {
-        for(m=0; digit[m]; m++ ) {
-	 	ptyname[8] = ch[l];
-		ptyname[9] = digit[m];
-		/* Open the master */
-		if( (mr_fd=open(ptyname, O_RDWR)) < 0 )
-	 	   continue;
+    /* This algorithm works for UNIX98 PTS */	
+
+    /* Open the master */
+    mr_fd = openpty(&master, &slave, ptyname, NULL, NULL);
+    if (mr_fd == -1)
+    {
+      printf("error open pty");
+      return -1;
+    }
+    else
+    {
 		/* Check the slave */
-		ptyname[5] = 't';
 		if( (access(ptyname, R_OK | W_OK)) < 0 ){
-		   close(mr_fd);
-		   ptyname[5] = 'p';
-		   continue;
+		   /* close(mr_fd); */
+		   return -1;
 		}
 		strcpy(sl_name,ptyname);
-		return mr_fd;
-	    }
-	}
-	return -1;
+		return master;
+   }
 #endif
 }
 
diff -urN vtun-3.0.1/Makefile.in vtun-3.0.1_patched_pts/Makefile.in
--- vtun-3.0.1/Makefile.in	2006-12-11 07:55:06.000000000 +0000
+++ vtun-3.0.1_patched_pts/Makefile.in	2007-11-19 10:49:49.889706604 +0000
@@ -19,7 +19,7 @@
 #  
 CC = @CC@
 CFLAGS = @CFLAGS@ @CPPFLAGS@
-LDFLAGS = @LIBS@
+LDFLAGS = @LIBS@ -lutil
 
 YACC = @YACC@
 YACCFLAGS = -d

Reply via email to