From 5bb3bd5007f0c9b14b077e85b686aa7950d27963 Mon Sep 17 00:00:00 2001 From: jim-p Date: Sun, 14 Jul 2013 14:20:06 -0400 Subject: Replace spaces in a CN with _ in filenames when exporting an OpenVPN client. Also only use a CN if there isn't a username to use instead. Unbreaks Windows Installer export with spaces in CN. --- config/openvpn-client-export/openvpn-client-export.inc | 4 ++-- config/openvpn-client-export/openvpn-client-export.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'config/openvpn-client-export') diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index b2c240ec..ac006d20 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -78,8 +78,8 @@ function openvpn_client_export_prefix($srvid, $usrid = null, $crtid = null) { $filename_addition = ""; if ($usrid && is_numeric($usrid)) $filename_addition = "-".$config['system']['user'][$usrid]['name']; - if ($crtid && is_numeric($crtid) && function_exists("cert_get_cn")) - $filename_addition = "-".cert_get_cn($config['cert'][$crtid]['crt']); + elseif ($crtid && is_numeric($crtid) && function_exists("cert_get_cn")) + $filename_addition = "-" . str_replace(' ', '_', cert_get_cn($config['cert'][$crtid]['crt'])); return "{$host}-{$prot}-{$port}{$filename_addition}"; } diff --git a/config/openvpn-client-export/openvpn-client-export.xml b/config/openvpn-client-export/openvpn-client-export.xml index e70139a7..fa96b40f 100755 --- a/config/openvpn-client-export/openvpn-client-export.xml +++ b/config/openvpn-client-export/openvpn-client-export.xml @@ -1,7 +1,7 @@ OpenVPN Client Export - 1.0.6 + 1.0.10 OpenVPN Client Export /usr/local/pkg/openvpn-client-export.inc -- cgit v1.2.3