mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
src: fix recent crash reports
This commit is contained in:
parent
daef385d8f
commit
6b0ebcae69
@ -71,11 +71,12 @@ $openvpn_compression_modes = array(
|
||||
'adaptive' => gettext("Enabled with Adaptive Compression"),
|
||||
'yes' => gettext("Enabled without Adaptive Compression"));
|
||||
|
||||
function openvpn_create_key() {
|
||||
|
||||
function openvpn_create_key()
|
||||
{
|
||||
$fp = popen("/usr/local/sbin/openvpn --genkey --secret /dev/stdout 2>/dev/null", "r");
|
||||
if (!$fp)
|
||||
if (!$fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$rslt = stream_get_contents($fp);
|
||||
pclose($fp);
|
||||
@ -83,18 +84,25 @@ function openvpn_create_key() {
|
||||
return $rslt;
|
||||
}
|
||||
|
||||
function openvpn_vpnid_used($vpnid) {
|
||||
function openvpn_vpnid_used($vpnid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (is_array($config['openvpn']['openvpn-server']))
|
||||
foreach ($config['openvpn']['openvpn-server'] as & $settings)
|
||||
if ($vpnid == $settings['vpnid'])
|
||||
if (isset($config['openvpn']['openvpn-server'])) {
|
||||
foreach ($config['openvpn']['openvpn-server'] as &$settings) {
|
||||
if ($vpnid == $settings['vpnid']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($config['openvpn']['openvpn-client']))
|
||||
foreach ($config['openvpn']['openvpn-client'] as & $settings)
|
||||
if ($vpnid == $settings['vpnid'])
|
||||
if (isset($config['openvpn']['openvpn-client'])) {
|
||||
foreach ($config['openvpn']['openvpn-client'] as &$settings) {
|
||||
if ($vpnid == $settings['vpnid']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -260,15 +260,14 @@ function restore_config_section_xmlrpc($new_config)
|
||||
|
||||
$vipbackup = array();
|
||||
$oldvips = array();
|
||||
if (isset($new_config['virtualip'])) {
|
||||
if (isset($config['virtualip']['vip'])) {
|
||||
foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
|
||||
if ($vip['mode'] == "carp")
|
||||
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
|
||||
else if ($vip['mode'] == "ipalias" && (strstr($vip['interface'], "_vip") || strstr($vip['interface'], "lo0")))
|
||||
$oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
|
||||
else if (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(strstr($vip['interface'], "_vip") || strstr($vip['interface'], "lo0")))
|
||||
$vipbackup[] = $vip;
|
||||
if (isset($config['virtualip']['vip'])) {
|
||||
foreach ($config['virtualip']['vip'] as $vipindex => $vip) {
|
||||
if ($vip['mode'] == "carp") {
|
||||
$oldvips["{$vip['interface']}_vip{$vip['vhid']}"] = "{$vip['password']}{$vip['advskew']}{$vip['subnet']}{$vip['subnet_bits']}{$vip['advbase']}";
|
||||
} elseif ($vip['mode'] == "ipalias" && (strstr($vip['interface'], "_vip") || strstr($vip['interface'], "lo0"))) {
|
||||
$oldvips[$vip['subnet']] = "{$vip['interface']}{$vip['subnet']}{$vip['subnet_bits']}";
|
||||
} elseif (($vip['mode'] == "ipalias" || $vip['mode'] == 'proxyarp') && !(strstr($vip['interface'], "_vip") || strstr($vip['interface'], "lo0"))) {
|
||||
$vipbackup[] = $vip;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,10 +277,10 @@ function restore_config_section_xmlrpc($new_config)
|
||||
|
||||
/* Then add ipalias and proxyarp types already defined on the backup */
|
||||
if (is_array($vipbackup) && !empty($vipbackup)) {
|
||||
if (!is_array($config['virtualip'])) {
|
||||
if (!isset($config['virtualip'])) {
|
||||
$config['virtualip'] = array();
|
||||
}
|
||||
if (!is_array($config['virtualip']['vip'])) {
|
||||
if (!isset($config['virtualip']['vip'])) {
|
||||
$config['virtualip']['vip'] = array();
|
||||
}
|
||||
foreach ($vipbackup as $vip) {
|
||||
@ -298,7 +297,7 @@ function restore_config_section_xmlrpc($new_config)
|
||||
* The real work on handling the vips specially
|
||||
* This is a copy of intefaces_vips_configure with addition of not reloading existing/not changed carps
|
||||
*/
|
||||
if (isset($new_config['virtualip']) && is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
|
||||
if (isset($new_config['virtualip']['vip'])) {
|
||||
$carp_setuped = false;
|
||||
$anyproxyarp = false;
|
||||
foreach ($config['virtualip']['vip'] as $vip) {
|
||||
|
||||
@ -763,7 +763,7 @@ include("head.inc");
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (is_array($config['virtualip']['vip'])):
|
||||
<?php if (isset($config['virtualip']['vip'])):
|
||||
foreach ($config['virtualip']['vip'] as $sn):
|
||||
if (isset($sn['noexpand']))
|
||||
continue;
|
||||
|
||||
@ -282,7 +282,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
if (($_POST['ipprotocol'] <> "") && ($_POST['gateway'] <> "")) {
|
||||
if(is_array($config['gateways']['gateway_group'])) {
|
||||
if (isset($config['gateways']['gateway_group'])) {
|
||||
foreach($config['gateways']['gateway_group'] as $gw_group) {
|
||||
if($gw_group['name'] == $_POST['gateway']) {
|
||||
$family = $a_gatewaygroups[$_POST['gateway']]['ipprotocol'];
|
||||
|
||||
@ -33,9 +33,10 @@ require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
require_once("filter.inc");
|
||||
|
||||
if (!is_array($config['virtualip']['vip'])) {
|
||||
if (!isset($config['virtualip']['vip'])) {
|
||||
$config['virtualip']['vip'] = array();
|
||||
}
|
||||
|
||||
$a_vip = &$config['virtualip']['vip'];
|
||||
|
||||
if ($_POST) {
|
||||
|
||||
@ -30,8 +30,9 @@
|
||||
require_once("guiconfig.inc");
|
||||
require_once("interfaces.inc");
|
||||
|
||||
if (!is_array($config['ifgroups']['ifgroupentry']))
|
||||
if (!isset($config['ifgroups']['ifgroupentry'])) {
|
||||
$config['ifgroups']['ifgroupentry'] = array();
|
||||
}
|
||||
|
||||
$a_ifgroups = &$config['ifgroups']['ifgroupentry'];
|
||||
|
||||
|
||||
@ -660,8 +660,9 @@ function step12_submitphpaction() {
|
||||
$config['filter']['rule'][] = $rule;
|
||||
}
|
||||
|
||||
if (!is_array($config['openvpn']['openvpn-server']))
|
||||
if (!isset($config['openvpn']['openvpn-server'])) {
|
||||
$config['openvpn']['openvpn-server'] = array();
|
||||
}
|
||||
|
||||
$config['openvpn']['openvpn-server'][] = $server;
|
||||
|
||||
@ -670,5 +671,3 @@ function step12_submitphpaction() {
|
||||
header("Location: vpn_openvpn_server.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user