Package: kvpnc
Version: 0.8.6.1-1
Severity: important
Tags: patch
kvpnc generates scripts used to control the vpn commands. Some of these
scripts will contain bashisms that will cause them to fail when using
/bin/dash. Some scripts will also not have #!/bin/sh lines or will not have
them as the first line. In particular, the vpnc-{profile}-disconnect.sh has
no
#! line and uses a non-POSIX redirect, causing kvpnc the fail when attempting
to disconnect. The GUI, however, does not realize the failure and assumes the
disconnect was successful, but vpnc will still be connected. Therefore,
subsequent attempts to connect to a vpn will be blocked because vpnc is still
bound to the required port(s). Attached is a patch that will alter the script
generation code that fixes the problem. I have tested it with vpnc but
unfortunately I do not have any other vpn connections, so scripts for the
other
clients may still contain bashisms.-- System Information: Debian Release: 4.0 APT prefers testing APT policy: (500, 'testing') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/dash Kernel: Linux 2.6.17-2-686 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages kvpnc depends on: ii kdebase-bin 4:3.5.5a.dfsg.1-1 core binaries for the KDE base mod ii kdelibs4c2a 4:3.5.5a.dfsg.1-3 core libraries and binaries for al ii libc6 2.3.6.ds1-7 GNU C Library: Shared libraries ii libgcc1 1:4.1.1-19 GCC support library ii libgcrypt11 1.2.3-2 LGPL Crypto library - runtime libr ii libice6 1:1.0.1-2 X11 Inter-Client Exchange library ii libpng12-0 1.2.8rel-7 PNG library - runtime ii libqt3-mt 3:3.3.7-1 Qt GUI Library (Threaded runtime v ii libsm6 1:1.0.1-3 X11 Session Management library ii libstdc++6 4.1.1-19 The GNU Standard C++ Library v3 ii libx11-6 2:1.0.3-2 X11 client-side library ii libxext6 1:1.0.1-2 X11 miscellaneous extension librar ii menu 2.1.31 generates programs menu for all me ii module-init-tools 3.2.2-3 tools for managing Linux kernel mo ii net-tools 1.60-17 The NET-3 networking toolkit ii psmisc 22.3-1 Utilities that use the proc filesy ii zlib1g 1:1.2.3-13 compression library - runtime kvpnc recommends no packages. -- no debconf information
--- kvpnc.cpp.orig 2006-09-28 13:48:42.000000000 -0400
+++ kvpnc.cpp 2006-11-10 15:39:19.000000000 -0500
@@ -987,7 +987,7 @@
QFile file ( VpncScript );
QTextStream stream( &file );
if ( file.open( IO_WriteOnly ) ) {
- stream << "#!/bin/bash" << "\n";
+ stream << "#!/bin/sh" << "\n";
stream << "#* reason -- why this script was called, one of: pre-init connect disconnect\n";
stream << "#* VPNGATEWAY -- vpn gateway address (always present)\n";
stream << "#* TUNDEV -- tunnel device (always present)\n";
@@ -2513,9 +2513,9 @@
QFile up1file( tmpPath + "pppd." + GlobalConfig->currentProfile->getName() + ".up1" );
QTextStream up1stream( &up1file );
if ( up1file.open( IO_WriteOnly ) ) {
+ up1stream << "#!/bin/sh" << "\n";
up1stream << "# generated by kvpnc. Do not edit it." << "\n";
up1stream << "# profile: " + GlobalConfig->currentProfile->getName() << "\n\n";
- up1stream << "#!/bin/sh" << "\n";
up1stream << "cp /etc/resolv.conf " << tmpPath + "resolv.conf." + GlobalConfig->currentProfile->getName() << "\n";
}
up1file.close();
@@ -3362,10 +3362,10 @@
QFile upfile( tmpPath + "openvpn." + GlobalConfig->currentProfile->getName() + ".up" );
QTextStream upstream( &upfile );
if ( upfile.open( IO_WriteOnly ) ) {
+ upstream << "#!/bin/sh" << "\n";
upstream << "# generated by kvpnc. Do not edit it." << "\n";
upstream << "# profile: " + GlobalConfig->currentProfile->getName() << "\n\n";
/* uses parts of http://www.smop.co.uk/node/69 */
- upstream << "#!/bin/sh" << "\n";
upstream << "if [ -f /etc/resolv.conf ]; then\n";
upstream << " cp /etc/resolv.conf " << tmpPath + "resolv.conf." + GlobalConfig->currentProfile->getName() << "\n";
upstream << "else\n";
@@ -3502,7 +3502,7 @@
QFile file( VpncDisconnectScript );
QTextStream stream( &file );
if ( file.open( IO_WriteOnly ) ) {
- // stream << "#!/bin/bash\n";
+ stream << "#!/bin/sh\n";
stream << "# generated by kvpnc. Do not edit it." << "\n";
stream << "# profile: " + GlobalConfig->currentProfile->getName() << "\n";
stream << "\n";
@@ -3510,12 +3510,12 @@
if ( !Vpnc_pid.isEmpty() ) {
if ( GlobalConfig->VpncDebugLevel > 0 )
GlobalConfig->appendLogEntry( i18n( "Vpnc pid file found, killing process %1" ).arg( Vpnc_pid ) , GlobalConfig->debug );
- stream << GlobalConfig->pathToKill << " -3 " << Vpnc_pid << " 2>&1>/dev/null\n";
- stream << GlobalConfig->pathToKill << " -3 " << Vpnc_pid << " 2>&1>/dev/null\n";
+ stream << GlobalConfig->pathToKill << " -3 " << Vpnc_pid << " > /dev/null 2>&1\n";
+ stream << GlobalConfig->pathToKill << " -3 " << Vpnc_pid << " > /dev/null 2>&1\n";
} else {
if ( GlobalConfig->KvpncDebugLevel > 0 )
GlobalConfig->appendLogEntry( i18n( "No vpnc pid file found, using \"killall\" for killing vpnc." ), GlobalConfig->debug );
- stream << GlobalConfig->pathToKillall << " -3 vpnc" << " 2>&1>/dev/null\n";
+ stream << GlobalConfig->pathToKillall << " -3 vpnc" << " > /dev/null 2>&1\n";
}
if ( !GlobalConfig->currentProfile->getKeepDefaultRoute() ) {
@@ -3798,9 +3798,9 @@
QFile downfile( tmpPath + "pppd." + GlobalConfig->currentProfile->getName() + ".down" );
QTextStream downstream( &downfile );
if ( downfile.open( IO_WriteOnly ) ) {
+ downstream << "#!/bin/sh" << "\n";
downstream << "# generated by kvpnc. Do not edit it." << "\n";
downstream << "# profile: " + GlobalConfig->currentProfile->getName() << "\n\n";
- downstream << "#!/bin/sh" << "\n";
downstream << "cp " << tmpPath + "resolv.conf." + GlobalConfig->currentProfile->getName() << " /etc/resolv.conf\n";
}
downfile.close();
@@ -5103,9 +5103,9 @@
QFile upfile( tmpPath + "pppd." + GlobalConfig->currentProfile->getName() + ".up" );
QTextStream upstream( &upfile );
if ( upfile.open( IO_WriteOnly ) ) {
+ upstream << "#!/bin/sh" << "\n";
upstream << "# generated by kvpnc. Do not edit it." << "\n";
upstream << "# profile: " + GlobalConfig->currentProfile->getName() << "\n\n";
- upstream << "#!/bin/sh" << "\n";
if ( !TmpDns1.isEmpty() && !TmpDns2.isEmpty() ) {
upstream << "echo \"# generated by kvpnc. Do not edit it.\" > /etc/resolv.conf" << "\n";
upstream << "echo \"# profile: " + GlobalConfig->currentProfile->getName() << "\" >> /etc/resolv.conf" << "\n";
@@ -7952,7 +7952,7 @@
QTextStream stream( &file );
if ( file.open( IO_WriteOnly ) ) {
stream << "# generated by kvpnc. Do not edit it." << "\n";
- stream << GlobalConfig->pathToRoute + " del default 2>&1>/dev/null\n";
+ stream << GlobalConfig->pathToRoute + " del default > /dev/null 2>&1\n";
stream << GlobalConfig->pathToIp + " route add " + line + "\n"; // ip route add default via 192.168.0.5 dev eth0
file.close();
}
pgpgjoKcdlIF8.pgp
Description: PGP signature

