ports/110320: [security/vpnc] rc script returns 0 on failure

Dominic Fandrey lon_kamikaze at gmx.de
Thu Mar 15 07:20:05 UTC 2007


>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 at 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:



More information about the freebsd-ports-bugs mailing list