summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/vpn_openvpn_client.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-11-26 17:43:34 +0545
committerPhil Davis <phil.davis@inf.org>2015-11-26 17:43:34 +0545
commitf4eec2507cb912290cbf156a49d790139e08f13d (patch)
tree4a42491e7ab57457f96a5d5c3d375de0f0533b7b /src/usr/local/www/vpn_openvpn_client.php
parent5176e08fbbe7c625020acf70df3f42636048a55e (diff)
downloadpfsense-f4eec2507cb912290cbf156a49d790139e08f13d.zip
pfsense-f4eec2507cb912290cbf156a49d790139e08f13d.tar.gz
Put some OpenVPN functions into include file
Forum: https://forum.pfsense.org/index.php?topic=103036.msg574854#msg574854 A few functions were in both client and server PHP already and were the same. build_crl_list() was missing from client PHP. build_cert_list() was slightly different in server and client PHP. I made a common one that takes a parameter. Maybe actually they should both be the same? or? Anyway for the first iteration I went for consolidation with no change of code behavior. Some functions were only in server PHP and only used by server PHP. I moved them to openvpn.inc anyway - seems more logical for the future. But say if you prefer them back in just server PHP.
Diffstat (limited to 'src/usr/local/www/vpn_openvpn_client.php')
-rw-r--r--src/usr/local/www/vpn_openvpn_client.php72
1 files changed, 3 insertions, 69 deletions
diff --git a/src/usr/local/www/vpn_openvpn_client.php b/src/usr/local/www/vpn_openvpn_client.php
index d249e07..806eb9d 100644
--- a/src/usr/local/www/vpn_openvpn_client.php
+++ b/src/usr/local/www/vpn_openvpn_client.php
@@ -406,72 +406,6 @@ if ($_POST) {
include("head.inc");
-function build_if_list() {
- $list = array();
-
- $interfaces = get_configured_interface_with_descr();
- $carplist = get_configured_carp_interface_list();
-
- foreach ($carplist as $cif => $carpip)
- $interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
-
- $aliaslist = get_configured_ip_aliases_list();
-
- foreach ($aliaslist as $aliasip => $aliasif)
- $interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
-
- $grouplist = return_gateway_groups_array();
-
- foreach ($grouplist as $name => $group) {
- if($group['ipprotocol'] != inet)
- continue;
-
- if($group[0]['vip'] != "")
- $vipif = $group[0]['vip'];
- else
- $vipif = $group[0]['int'];
-
- $interfaces[$name] = "GW Group {$name}";
- }
-
- $interfaces['lo0'] = "Localhost";
- $interfaces['any'] = "any";
-
- foreach ($interfaces as $iface => $ifacename)
- $list[$iface] = $ifacename;
-
- return($list);
-}
-
-function build_cert_list() {
- global $a_cert;
-
- $list = array('' => 'None (Username and/or Password required)');
-
- foreach ($a_cert as $cert) {
- $caname = "";
- $inuse = "";
- $revoked = "";
- $ca = lookup_ca($cert['caref']);
-
- if ($ca)
- $caname = " (CA: {$ca['descr']})";
-
- if ($pconfig['certref'] == $cert['refid'])
- $selected = "selected=\"selected\"";
-
- if (cert_in_use($cert['refid']))
- $inuse = " *In Use";
-
- if (is_cert_revoked($cert))
- $revoked = " *Revoked";
-
- $list[$cert['refid']] = $cert['descr'] . $caname . $inuse . $revoked;
- }
-
- return($list);
-}
-
if (!$savemsg)
$savemsg = "";
@@ -526,7 +460,7 @@ if($act=="new" || $act=="edit") :
'interface',
'Interface',
$pconfig['interface'],
- build_if_list()
+ openvpn_build_if_list()
));
$section->addInput(new Form_Input(
@@ -660,7 +594,7 @@ if($act=="new" || $act=="edit") :
'crlref',
'Peer Certificate Revocation list',
$pconfig['crlref'],
- build_crl_list()
+ openvpn_build_crl_list()
));
} else {
$section->addInput(new Form_StaticText(
@@ -686,7 +620,7 @@ if($act=="new" || $act=="edit") :
'certref',
'Client Certificate',
$pconfig['certref'],
- build_cert_list()
+ openvpn_build_cert_list(true)
));
$section->addInput(new Form_Select(
OpenPOWER on IntegriCloud