ports/145207: [patch] security/vpnc fix rc.d script return value

Dominic Fandrey kamikaze at bsdforen.de
Tue Mar 30 15:00:18 UTC 2010


>Number:         145207
>Category:       ports
>Synopsis:       [patch] security/vpnc fix rc.d script return value
>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:   Tue Mar 30 15:00:17 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        RELENG_8
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 8.0-STABLE FreeBSD 8.0-STABLE #0: Tue Mar 30 15:10:11 CEST 2010     root at mobileKamikaze.norad:/usr/obj/HP6510b-8/amd64/usr/src/sys/HP6510b-8  amd64

>Description:
The rc.d script always returns 0, even when establishing the connection fails.

This is cause by the following code:

if ! $command --local-port 0 $current $vpnc_flags; then
	status=$?
	... error handling ...
	return $status
fi


! $command ...
returns 0 in case of an error, which is what will be assigned to status, instead of the error code issued by vpnc.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -Nur vpnc.orig/files/vpnc.in vpnc/files/vpnc.in
--- vpnc.orig/files/vpnc.in	2010-03-30 16:14:37.000000000 +0200
+++ vpnc/files/vpnc.in	2010-03-30 16:15:37.000000000 +0200
@@ -44,8 +44,9 @@
 		current="$vpnc_conf_dir/$config"
 
 		# Start vpnc.
-		if ! $command --local-port 0 $current $vpnc_flags; then
-			status=$?
+		$command --local-port 0 $current $vpnc_flags
+		status=$?
+		if [ $status -ne 0 ]; then
 			# VPNC does not print a newline after an error.
 			echo
 			echo "Running 'vpnc $current --local-port 0 $vpnc_flags' failed."


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list