summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-03-10 10:40:52 +0000
committerErmal Luçi <eri@pfsense.org>2010-03-10 10:40:52 +0000
commit8a47c19021dde35a19f3fe83938d3edcfd6c76d6 (patch)
tree03bd32eedcf13f9f8a36c55e7c81ced0b283f425 /etc
parent5a8a69b3126309dd7024f5d9a1b106024c0ffa4e (diff)
downloadpfsense-8a47c19021dde35a19f3fe83938d3edcfd6c76d6.zip
pfsense-8a47c19021dde35a19f3fe83938d3edcfd6c76d6.tar.gz
Ticket #413. Hanlde cases when no authentication is specified.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/openvpn.inc26
1 files changed, 14 insertions, 12 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index c9b4313..766dce3 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -382,19 +382,21 @@ function openvpn_reconfigure($mode,& $settings) {
$conf .= "client-cert-not-required\n";
case 'server_tls_user':
$conf .= "username-as-common-name\n";
- $authcfgs = explode(",", $settings['authmode']);
- $sed = "\$authmodes=array(";
- $firstsed = 0;
- foreach ($authcfgs as $authcfg) {
- if ($firstsed > 0)
- $sed .= ",";
- $firstsed = 1;
- $sed .= "\"{$authcfg}\"";
+ if (!empty($settings['authmode'])) {
+ $authcfgs = explode(",", $settings['authmode']);
+ $sed = "\$authmodes=array(";
+ $firstsed = 0;
+ foreach ($authcfgs as $authcfg) {
+ if ($firstsed > 0)
+ $sed .= ",";
+ $firstsed = 1;
+ $sed .= "\"{$authcfg}\"";
+ }
+ $sed .= ");";
+ mwexec("/bin/cat /etc/inc/openvpn.auth-user.php | /usr/bin/sed 's/\/\/<template>/{$sed}/g' > {$g['varetc_path']}/openvpn/{$mode_id}.php");
+ mwexec("/bin/chmod a+x {$g['varetc_path']}/openvpn/{$mode_id}.php");
+ $conf .= "auth-user-pass-verify {$g['varetc_path']}/openvpn/{$mode_id}.php via-env\n";
}
- $sed .= ");";
- mwexec("/bin/cat /etc/inc/openvpn.auth-user.php | /usr/bin/sed 's/\/\/<template>/{$sed}/g' > {$g['varetc_path']}/openvpn/{$mode_id}.php");
- mwexec("/bin/chmod a+x {$g['varetc_path']}/openvpn/{$mode_id}.php");
- $conf .= "auth-user-pass-verify {$g['varetc_path']}/openvpn/{$mode_id}.php via-env\n";
break;
}
OpenPOWER on IntegriCloud