diff options
author | jim-p <jim@pingle.org> | 2010-09-04 15:26:55 -0400 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-09-04 15:26:55 -0400 |
commit | 6837018078c4df27b44522532b0644a48ec1ceb7 (patch) | |
tree | b384ff1234eccdd5b304ffd4325dddf5084dd673 | |
parent | 0f44a289caec586d72fd07ea2abc6d2d3a514e69 (diff) | |
download | pfsense-packages-6837018078c4df27b44522532b0644a48ec1ceb7.tar.gz pfsense-packages-6837018078c4df27b44522532b0644a48ec1ceb7.tar.bz2 pfsense-packages-6837018078c4df27b44522532b0644a48ec1ceb7.zip |
Update OpenVPN client export package to work with the new user cert setup (and retain compatibility with the old setup too)
-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(); |