summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorjim-p <jim@pingle.org>2010-04-12 16:40:30 -0400
committerjim-p <jim@pingle.org>2010-04-12 16:40:30 -0400
commit6f8b8ed05b0937905caeaebe1f97bde74f6816f4 (patch)
tree8f2f66fea45ea8a099a7b6af569c580a80d03819 /usr
parent916fae48c6bf5011475dbcab57310e21cc9907c6 (diff)
downloadpfsense-6f8b8ed05b0937905caeaebe1f97bde74f6816f4.zip
pfsense-6f8b8ed05b0937905caeaebe1f97bde74f6816f4.tar.gz
Prevent duplication of CA names and Cert names in the OpenVPN wizard. Ticket #500.
Diffstat (limited to 'usr')
-rw-r--r--usr/local/www/wizards/openvpn_wizard.inc16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/local/www/wizards/openvpn_wizard.inc b/usr/local/www/wizards/openvpn_wizard.inc
index 3ccfb93..48b4550 100644
--- a/usr/local/www/wizards/openvpn_wizard.inc
+++ b/usr/local/www/wizards/openvpn_wizard.inc
@@ -169,12 +169,20 @@ function step6_submitphpaction() {
function step7_submitphpaction() {
global $stepid, $savemsg, $_POST, $config;
+
+ $canames = array();
+ foreach($config['system']['ca'] as $ca) {
+ $canames[] = $ca['name'];
+ }
if (empty($_POST['name']) || empty($_POST['keylength']) || empty($_POST['lifetime']) ||
empty($_POST['country']) || empty($_POST['state']) || empty($_POST['city']) ||
empty($_POST['organization']) || empty($_POST['email'])) {
$stepid--;
$savemsg = "Please enter all information for the new Certificate Authority.";
+ } elseif (in_array($_POST['name'], $canames)) {
+ $stepid--;
+ $savemsg = "Please enter a different name for the Certicicate Authority. A Certificate Authority with that name already exists.";
} else {
$config['ovpnserver']['step6']['uselist'] = "on";
$_POST['uselist'] = "on";
@@ -240,11 +248,19 @@ function step9_stepbeforeformdisplay() {
function step9_submitphpaction() {
global $stepid, $savemsg, $_POST, $config;
+ $certnames = array();
+ foreach($config['system']['cert'] as $cert) {
+ $certnames[] = $cert['name'];
+ }
+
if (empty($_POST['name']) || empty($_POST['keylength']) || empty($_POST['lifetime']) ||
empty($_POST['country']) || empty($_POST['state']) || empty($_POST['city']) ||
empty($_POST['organization']) || empty($_POST['email'])) {
$stepid--;
$savemsg = "Please enter all information for the new certificate.";
+ } elseif (in_array($_POST['name'], $certnames)) {
+ $stepid--;
+ $savemsg = "Please enter a different name for the Certicicate. A Certificate with that name already exists.";
} else {
$config['ovpnserver']['step9']['uselist'] = "on";
$_POST['uselist'] = "on";
OpenPOWER on IntegriCloud