diff options
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 9 | ||||
-rwxr-xr-x | config/openvpn-client-export/vpn_openvpn_export.php | 10 |
2 files changed, 16 insertions, 3 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index 8d7d338b..7cffaf3e 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -126,6 +126,9 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke $cert =& $user['cert'][$crtid]; if (!$cert) return false; + // If $cert is not an array, it's a certref not a cert. + if (!is_array($cert)) + $cert = lookup_cert($cert); } else $nokeys = true; @@ -288,6 +291,9 @@ function openvpn_client_export_installer($srvid, $usrid, $crtid, $useaddr, $uset $cert =& $user['cert'][$crtid]; if (!$cert) return false; + // If $cert is not an array, it's a certref not a cert. + if (!is_array($cert)) + $cert = lookup_cert($cert); } else $nokeys = true; @@ -401,6 +407,9 @@ function viscosity_openvpn_client_config_exporter($srvid, $usrid, $crtid, $usead $cert =& $user['cert'][$crtid]; if (!$cert) return false; + // If $cert is not an array, it's a certref not a cert. + if (!is_array($cert)) + $cert = lookup_cert($cert); } // create template directory diff --git a/config/openvpn-client-export/vpn_openvpn_export.php b/config/openvpn-client-export/vpn_openvpn_export.php index b2d446f2..d876b519 100755 --- a/config/openvpn-client-export/vpn_openvpn_export.php +++ b/config/openvpn-client-export/vpn_openvpn_export.php @@ -47,16 +47,20 @@ if (!is_array($config['system']['user'])) $a_user = $config['system']['user']; $ras_server = array(); -foreach($a_server as $sindex => & $server) { +foreach($a_server as $sindex => $server) { if (isset($server['disable'])) continue; $ras_user = array(); if (stripos($server['mode'], "server") === false) continue; - foreach($a_user as $uindex => & $user) { + foreach($a_user as $uindex => $user) { if (!is_array($user['cert'])) continue; - foreach($user['cert'] as $cindex => & $cert) { + foreach($user['cert'] as $cindex => $cert) { + // If $cert is not an array, it's a certref not a cert. + if (!is_array($cert)) + $cert = lookup_cert($cert); + if ($cert['caref'] != $server['caref']) continue; $ras_userent = array(); |