diff options
author | jim-p <jimp@pfsense.org> | 2012-04-04 16:10:44 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-04-04 16:47:32 -0400 |
commit | b5d8b863147cff56adf481200ca04fea0b89fbc6 (patch) | |
tree | 6d9d2676615b0513cc9502ef711ba5866a9acb02 /config | |
parent | 2a5327ac65a3cdf08c47df669b8c39ca6369a93e (diff) | |
download | pfsense-packages-b5d8b863147cff56adf481200ca04fea0b89fbc6.tar.gz pfsense-packages-b5d8b863147cff56adf481200ca04fea0b89fbc6.tar.bz2 pfsense-packages-b5d8b863147cff56adf481200ca04fea0b89fbc6.zip |
Handle a blank hostname a bit more gracefully when exporting OpenVPN.
Diffstat (limited to 'config')
-rwxr-xr-x | config/openvpn-client-export/openvpn-client-export.inc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/config/openvpn-client-export/openvpn-client-export.inc b/config/openvpn-client-export/openvpn-client-export.inc index b9ac8866..22f31a21 100755 --- a/config/openvpn-client-export/openvpn-client-export.inc +++ b/config/openvpn-client-export/openvpn-client-export.inc @@ -71,7 +71,7 @@ function openvpn_client_export_prefix($srvid) { if ($settings['disable']) return false; - $host = $config['system']['hostname']; + $host = empty($config['system']['hostname']) ? "openvpn" : $config['system']['hostname']; $prot = ($settings['protocol'] == 'UDP' ? 'udp' : $settings['protocol']); $port = $settings['local_port']; @@ -161,7 +161,8 @@ function openvpn_client_export_config($srvid, $usrid, $crtid, $useaddr, $usetoke $server_host = get_interface_ip($interface); } } else if ($useaddr == "serverhostname" || empty($useaddr)) { - $server_host = "{$config['system']['hostname']}.{$config['system']['domain']}"; + $server_host = empty($config['system']['hostname']) "" : "{$config['system']['hostname']}."; + $server_host .= "{{$config['system']['domain']}"; } else $server_host = $useaddr; @@ -600,7 +601,8 @@ function openvpn_client_export_sharedkey_config($srvid, $useaddr, $proxy, $zipco $server_host = get_interface_ip($interface); } } else if ($useaddr == "serverhostname" || empty($useaddr)) { - $server_host = "{$config['system']['hostname']}.{$config['system']['domain']}"; + $server_host = empty($config['system']['hostname']) "" : "{$config['system']['hostname']}."; + $server_host .= "{{$config['system']['domain']}"; } else $server_host = $useaddr; |