summaryrefslogtreecommitdiffstats
path: root/etc/inc/openvpn.inc
diff options
context:
space:
mode:
Diffstat (limited to 'etc/inc/openvpn.inc')
-rw-r--r--etc/inc/openvpn.inc16
1 files changed, 13 insertions, 3 deletions
diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc
index 927a3ec..23ae85c 100644
--- a/etc/inc/openvpn.inc
+++ b/etc/inc/openvpn.inc
@@ -789,11 +789,21 @@ function openvpn_reconfigure($mode, $settings) {
}
}
- if ($settings['auth_user'] && $settings['auth_pass']) {
+ if ($settings['auth_user'] || $settings['auth_pass']) {
$up_file = "{$g['varetc_path']}/openvpn/{$mode_id}.up";
$conf .= "auth-user-pass {$up_file}\n";
- $userpass = "{$settings['auth_user']}\n";
- $userpass .= "{$settings['auth_pass']}\n";
+ if ($settings['auth_user']) {
+ $userpass = "{$settings['auth_user']}\n";
+ } else {
+ $userpass = "";
+ }
+ if ($settings['auth_pass']) {
+ $userpass .= "{$settings['auth_pass']}\n";
+ }
+ // If only auth_pass is given, then it acts like a user name and we put a blank line where pass would normally go.
+ if (!($settings['auth_user'] && $settings['auth_pass'])) {
+ $userpass .= "\n";
+ }
file_put_contents($up_file, $userpass);
}
OpenPOWER on IntegriCloud