diff options
author | Marat Nepomnyashy <marat@vyatta.com> | 2008-02-21 16:54:59 -0800 |
---|---|---|
committer | Marat Nepomnyashy <marat@vyatta.com> | 2008-02-21 16:54:59 -0800 |
commit | df143e19aa57d04568dc428a4907046d4e0d5708 (patch) | |
tree | 3e532fbe42e508004179c45aecc7c2eea8321a4e /scripts | |
parent | 45b1f46e45a26af4154766be9c472dcf77845057 (diff) | |
download | vyatta-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-x | scripts/vpn-config.pl | 6 |
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; |