From a5a483e05b4db81fde402dfc943408a8b0d51de8 Mon Sep 17 00:00:00 2001 From: jim-p Date: Tue, 14 Feb 2012 13:02:14 -0500 Subject: Reject an interface without a subnet as a network source in the IPsec Phase 2 GUI. Fixes ticket #2201 --- usr/local/www/vpn_ipsec_phase2.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'usr/local') diff --git a/usr/local/www/vpn_ipsec_phase2.php b/usr/local/www/vpn_ipsec_phase2.php index 56f377a..1aeb498 100644 --- a/usr/local/www/vpn_ipsec_phase2.php +++ b/usr/local/www/vpn_ipsec_phase2.php @@ -130,6 +130,16 @@ if ($_POST) { break; } + /* Check if the localid_type is an interface, to confirm if it has a valid subnet. */ + if (is_array($config['interfaces'][$pconfig['localid_type']])) { + // Don't let an empty subnet into racoon.conf, it can cause parse errors. Ticket #2201. + $address = get_interface_ip($pconfig['localid_type']); + $netbits = get_interface_subnet($pconfig['localid_type']); + + if (empty($address) || empty($netbits)) + $input_errors[] = gettext("Invalid Local Network.") . " " . convert_friendly_interface_to_friendly_descr($pconfig['localid_type']) . " " . gettext("has no subnet."); + } + switch ($pconfig['remoteid_type']) { case "network": if (($pconfig['remoteid_netbits'] != 0 && !$pconfig['remoteid_netbits']) || !is_numeric($pconfig['remoteid_netbits'])) -- cgit v1.1