Commit b53cdb3f authored by Franco Fichtner's avatar Franco Fichtner

openvpn: merge GUI rewrites from master

parent 00118557
......@@ -40,8 +40,9 @@ function openvpn_client_export_prefix($srvid, $usrid = null, $crtid = null) {
$settings = $config['openvpn']['openvpn-server'][$srvid];
if (empty($settings))
return false;
if ($settings['disable'])
if (!empty($settings['disable'])) {
return false;
}
$host = empty($config['system']['hostname']) ? "openvpn" : $config['system']['hostname'];
$prot = ($settings['protocol'] == 'UDP' ? 'udp' : $settings['protocol']);
......@@ -75,6 +76,7 @@ function openvpn_client_pem_to_pk12($outpath, $outpass, $crtpath, $keypath, $cap
function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
global $config, $g, $input_errors;
$nokeys = false;
// lookup server settings
$settings = $config['openvpn']['openvpn-server'][$srvid];
......@@ -82,7 +84,7 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
$input_errors[] = "Could not locate server configuration.";
return false;
}
if ($settings['disable']) {
if (!empty($settings['disable'])) {
$input_errors[] = "You cannot export for disabled servers.";
return false;
}
......@@ -93,7 +95,7 @@ function openvpn_client_export_validate_config($srvid, $usrid, $crtid) {
{
$input_errors[] = "Could not locate server certificate.";
} else {
$server_ca = lookup_ca($server_cert['caref']);
$server_ca = isset($server_cert['caref']) ? lookup_ca($server_cert['caref']) : null;
if (!$server_ca) {
$input_errors[] = "Could not locate the CA reference for the server certificate.";
}
......
......@@ -29,12 +29,6 @@
POSSIBILITY OF SUCH DAMAGE.
*/
global $openvpn_prots;
$openvpn_prots = array("UDP", "UDP6", "TCP", "TCP6");
global $openvpn_dev_mode;
$openvpn_dev_mode = array("tun", "tap");
global $openvpn_verbosity_level;
$openvpn_verbosity_level = array(
0 => "none",
......@@ -302,8 +296,7 @@ function openvpn_add_dhcpopts(& $settings, & $conf) {
if (!empty($settings['ntp_server2']))
$conf .= "push \"dhcp-option NTP {$settings['ntp_server2']}\"\n";
if ($settings['netbios_enable']) {
if (!empty($settings['netbios_enable'])) {
if (!empty($settings['dhcp_nbttype']) && ($settings['dhcp_nbttype'] != 0))
$conf .= "push \"dhcp-option NBT {$settings['dhcp_nbttype']}\"\n";
if (!empty($settings['dhcp_nbtscope']))
......@@ -313,12 +306,9 @@ function openvpn_add_dhcpopts(& $settings, & $conf) {
$conf .= "push \"dhcp-option WINS {$settings['wins_server1']}\"\n";
if (!empty($settings['wins_server2']))
$conf .= "push \"dhcp-option WINS {$settings['wins_server2']}\"\n";
if (!empty($settings['nbdd_server1']))
$conf .= "push \"dhcp-option NBDD {$settings['nbdd_server1']}\"\n";
}
if ($settings['gwredir'])
if (!empty($settings['gwredir']))
$conf .= "push \"redirect-gateway def1\"\n";
}
......@@ -855,10 +845,10 @@ function openvpn_resync_csc(&$settings)
openvpn_create_dirs();
$conf = '';
if ($settings['block'])
if (!empty($settings['block']))
$conf .= "disable\n";
if ($settings['push_reset'])
if (!empty($settings['push_reset']))
$conf .= "push-reset\n";
if (!empty($settings['tunnel_network'])) {
......@@ -891,7 +881,7 @@ function openvpn_resync_csc(&$settings)
openvpn_add_dhcpopts($settings, $conf);
if ($settings['gwredir'])
if (!empty($settings['gwredir']))
$conf .= "push \"redirect-gateway def1\"\n";
openvpn_add_custom($settings, $conf);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment