Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Mar 2007 07:14:32 GMT
From:      Dominic Fandrey<lon_kamikaze@gmx.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/110320: [security/vpnc] rc script returns 0 on failure
Message-ID:  <200703150714.l2F7EWRN064013@www.freebsd.org>
Resent-Message-ID: <200703150720.l2F7K4CE094200@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         110320
>Category:       ports
>Synopsis:       [security/vpnc] rc script returns 0 on failure
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 15 07:20:04 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        Releng_6
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 6.2-STABLE FreeBSD 6.2-STABLE #0: Tue Feb 20 11:40:15 CET 2007     root@homeKamikaze.norad:/usr/obj/TPR40-6/i386/usr/src/sys/TPR40-6  i386
>Description:
In managed mode the script does not return the proper value

		# Start vpnc.
		if ! $command $current $vpnc_flags; then
			status=$?
			echo "Running 'vpnc $current $vpnc_flags' failed."
			return $status
		fi

$? is already unset by the if command and thus always 0, so that the script returns 0 instead of the return status of the failed vpnc call.
>How-To-Repeat:
You can start the script with a broken configuration (i.e. wrong password) in managed mode (don't use default config file).
>Fix:
--- vpnc.orig	Wed Mar 14 07:59:30 2007
+++ vpnc	Wed Mar 14 10:32:49 2007
@@ -43,9 +43,12 @@
 		current="$vpnc_conf_dir/$config"
 
 		# Start vpnc.
-		if ! $command $current $vpnc_flags; then
-			status=$?
-			echo "Running 'vpnc $current $vpnc_flags' failed."
+		$command --local-port 0 $current $vpnc_flags
+		status=$?
+		if [ $status != 0 ]; then
+			# VPNC does not print a newline after an error.
+			echo
+			echo "Running 'vpnc $current --local-port 0 $vpnc_flags' failed."
 			return $status
 		fi
 
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703150714.l2F7EWRN064013>