summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarat Nepomnyashy <marat@vyatta.com>2008-02-21 16:54:59 -0800
committerMarat Nepomnyashy <marat@vyatta.com>2008-02-21 16:54:59 -0800
commitdf143e19aa57d04568dc428a4907046d4e0d5708 (patch)
tree3e532fbe42e508004179c45aecc7c2eea8321a4e /scripts
parent45b1f46e45a26af4154766be9c472dcf77845057 (diff)
downloadvyatta-cfg-vpn-df143e19aa57d04568dc428a4907046d4e0d5708.tar.gz
vyatta-cfg-vpn-df143e19aa57d04568dc428a4907046d4e0d5708.zip
Check for the case when authentication mode is not specified to prevent Perl uninitialized value error. Bug 2772 fix.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vpn-config.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl
index dc5ed95..226fce1 100755
--- a/scripts/vpn-config.pl
+++ b/scripts/vpn-config.pl
@@ -652,8 +652,10 @@ if ($vcVPN->exists('ipsec')) {
# Write shared secrets to ipsec.secrets
#
my $auth_mode = $vcVPN->returnValue("ipsec site-to-site peer $peer authentication mode");
- if (defined($auth_mode) && ($auth_mode eq 'pre-shared-secret')) {
-
+ if (!defined($auth_mode) || $auth_mode eq '') {
+ $error = 1;
+ print STDERR "VPN configuration error. No authentication mode for peer \"$peer\" specified.\n";
+ } elsif (defined($auth_mode) && ($auth_mode eq 'pre-shared-secret')) {
my $psk = $vcVPN->returnValue("ipsec site-to-site peer $peer authentication pre-shared-secret");
if (!defined($psk) || $psk eq '') {
$error = 1;