diff options
author | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-18 15:49:52 -0300 |
---|---|---|
committer | Renato Botelho <renato.botelho@bluepex.com> | 2010-08-18 15:49:52 -0300 |
commit | 89ceb4ba3c6eb536dfd8c5905e3278c6bb27fa6e (patch) | |
tree | a44ea07415162e818ad4aba6eb990ff55e1c60a8 /etc/inc/vpn.inc | |
parent | 29c508f756b8fb6903da8502e1b125a0ef0d10de (diff) | |
download | pfsense-89ceb4ba3c6eb536dfd8c5905e3278c6bb27fa6e.zip pfsense-89ceb4ba3c6eb536dfd8c5905e3278c6bb27fa6e.tar.gz |
Implement gettext() calls on vpn.inc
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r-- | etc/inc/vpn.inc | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 1c204f0..33feb8e 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -123,7 +123,7 @@ function vpn_ipsec_configure($ipchg = false) mwexec("/sbin/ifconfig enc0 up"); if ($g['booting']) - echo "Configuring IPsec VPN... "; + echo gettext("Configuring IPsec VPN... "); /* fastforwarding is not compatible with ipsec tunnels */ mwexec("/sbin/sysctl net.inet.ip.fastforwarding=0"); @@ -209,18 +209,18 @@ function vpn_ipsec_configure($ipchg = false) if (is_array($config['system']['ca']) && count($config['system']['ca'])) { foreach ($config['system']['ca'] as $ca) { if (!isset($ca['crt'])) { - log_error("Error: Invalid certificate info for {$ca['name']}"); + log_error(sprintf(gettext("Error: Invalid certificate info for %s"), $ca['name'])); continue; } $cert = base64_decode($ca['crt']); $x509cert = openssl_x509_parse(openssl_x509_read($cert)); if (!is_array($x509cert) || !isset($x509cert['hash'])) { - log_error("Error: Invalid certificate hash info for {$ca['name']}"); + log_error(sprintf(gettext("Error: Invalid certificate hash info for %s"), $ca['name'])); continue; } $fname = $g['varetc_path']."/".$x509cert['hash'].".0"; if (!file_put_contents($fname, $cert)) { - log_error("Error: Cannot write IPsec CA file for {$ca['name']}"); + log_error(sprintf(gettext("Error: Cannot write IPsec CA file for %s"), $ca['name'])); continue; } } @@ -229,7 +229,7 @@ function vpn_ipsec_configure($ipchg = false) /* generate psk.txt */ $fd = fopen("{$g['varetc_path']}/psk.txt", "w"); if (!$fd) { - printf("Error: cannot open psk.txt in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open psk.txt in vpn_ipsec_configure().") . "\n"); return 1; } @@ -291,7 +291,7 @@ function vpn_ipsec_configure($ipchg = false) $fd = fopen("{$g['varetc_path']}/racoon.conf", "w"); if (!$fd) { - printf("Error: cannot open racoon.conf in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open racoon.conf in vpn_ipsec_configure().") . "\n"); return 1; } @@ -381,7 +381,7 @@ function vpn_ipsec_configure($ipchg = false) $fn = "{$g['varetc_path']}/racoon.motd"; $fd1 = fopen($fn, "w"); if (!$fd1) { - printf("Error: cannot open server{$fn} in vpn.\n"); + printf(gettext("Error: cannot open server %s in vpn.%s"). $fn, "\n"); return 1; } @@ -509,7 +509,7 @@ function vpn_ipsec_configure($ipchg = false) if (!$cert) { - log_error("Error: Invalid phase1 certificate reference for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Invalid phase1 certificate reference for %s"), $ph1ent['name'])); continue; } @@ -518,7 +518,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($certpath, base64_decode($cert['crt']))) { - log_error("Error: Cannot write phase1 certificate file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 certificate file for %s"), $ph1ent['name'])); continue; } @@ -529,7 +529,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($keypath, base64_decode($cert['prv']))) { - log_error("Error: Cannot write phase1 key file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 key file for %s"), $ph1ent['name'])); continue; } @@ -542,7 +542,7 @@ function vpn_ipsec_configure($ipchg = false) if (!file_put_contents($capath, base64_decode($ca['crt']))) { - log_error("Error: Cannot write phase1 CA certificate file for {$ph1ent['name']}"); + log_error(sprintf(gettext("Error: Cannot write phase1 CA certificate file for %s"), $ph1ent['name'])); continue; } @@ -761,7 +761,7 @@ EOD; /* generate spd.conf */ $fd = fopen("{$g['varetc_path']}/spd.conf", "w"); if (!$fd) { - printf("Error: cannot open spd.conf in vpn_ipsec_configure().\n"); + printf(gettext("Error: cannot open spd.conf in vpn_ipsec_configure().") . "\n"); return 1; } @@ -840,7 +840,7 @@ EOD; if(is_ipaddr($gatewayip)) { /* FIXME: does adding route-to and reply-to on the in/outbound * rules fix this? smos@ 13-01-2009 */ - log_error("IPSEC interface is not WAN but {$parentinterface}, adding static route for VPN endpoint {$rgip} via {$gatewayip}"); + log_error(sprintf(gettext("IPSEC interface is not WAN but %s, adding static route for VPN endpoint %s via %s"), $parentinterface, $rgip, $gatewayip)); mwexec("/sbin/route delete -host {$rgip}"); mwexec("/sbin/route add -host {$rgip} {$gatewayip}"); } @@ -931,7 +931,7 @@ function vpn_ipsec_force_reload() { /* if ipsec is enabled, start up again */ if (isset($ipseccfg['enable'])) { - log_error("Forcefully reloading IPsec racoon daemon"); + log_error(gettext("Forcefully reloading IPsec racoon daemon")); vpn_ipsec_configure(); } @@ -959,7 +959,7 @@ function vpn_pptpd_configure() { if (!$pptpdcfg['mode'] || ($pptpdcfg['mode'] == "off")) return 0; - echo "Configuring PPTP VPN service... "; + echo gettext("Configuring PPTP VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/pptp-vpn.pid"); @@ -969,7 +969,7 @@ function vpn_pptpd_configure() { if (is_process_running("mpd -b")) { killbypid("{$g['varrun_path']}/pptp-vpn.pid"); - log_error("Could not kill mpd within 3 seconds. Trying again."); + log_error(gettext("Could not kill mpd within 3 seconds. Trying again.")); } /* remove mpd.conf, if it exists */ @@ -987,7 +987,7 @@ function vpn_pptpd_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1100,7 +1100,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1124,7 +1124,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/pptp-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_pptpd_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_pptpd_configure().") . "\n"); return 1; } @@ -1168,7 +1168,7 @@ function vpn_pppoe_configure() { if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off")) return 0; - echo "Configuring PPPoE VPN service... "; + echo gettext("Configuring PPPoE VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/pppoe-vpn.pid"); @@ -1196,7 +1196,7 @@ function vpn_pppoe_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_pppoe_configure().") . "\n"); return 1; } $mpdconf = "\n\n"; @@ -1296,7 +1296,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_pppoe_configure().") . "\n"); return 1; } @@ -1321,7 +1321,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/pppoe-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_pppoe_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_pppoe_configure().") . "\n"); return 1; } @@ -1365,7 +1365,7 @@ function vpn_l2tp_configure() { if (!$l2tpcfg['mode'] || ($l2tpcfg['mode'] == "off")) return 0; - echo "Configuring l2tp VPN service... "; + echo gettext("Configuring l2tp VPN service... "); } else { /* kill mpd */ killbypid("{$g['varrun_path']}/l2tp-vpn.pid"); @@ -1390,7 +1390,7 @@ function vpn_l2tp_configure() { /* write mpd.conf */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.conf", "w"); if (!$fd) { - printf("Error: cannot open mpd.conf in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.conf in vpn_l2tp_configure().") . "\n"); return 1; } $mpdconf = "\n\n"; @@ -1480,7 +1480,7 @@ EOD; /* write mpd.links */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.links", "w"); if (!$fd) { - printf("Error: cannot open mpd.links in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.links in vpn_l2tp_configure().") . "\n"); return 1; } @@ -1505,7 +1505,7 @@ EOD; /* write mpd.secret */ $fd = fopen("{$g['varetc_path']}/l2tp-vpn/mpd.secret", "w"); if (!$fd) { - printf("Error: cannot open mpd.secret in vpn_l2tp_configure().\n"); + printf(gettext("Error: cannot open mpd.secret in vpn_l2tp_configure().") . "\n"); return 1; } @@ -1636,22 +1636,22 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { $rgip = resolve_retry($phase1['remote-gateway']); add_hostname_to_watch($phase1['remote-gateway']); if (!$rgip) { - log_error("Could not determine VPN endpoint for '{$phase1['descr']}'"); + log_error(sprintf(gettext("Could not determine VPN endpoint for '%s'"), $phase1['descr'])); return false; } } else { $rgip = $phase1['remote-gateway']; } if (!$ep) { - log_error("Could not determine VPN endpoint for '{$phase1['descr']}'"); + log_error(sprintf(gettext("Could not determine VPN endpoint for '%s'"), $phase1['descr'])); return false; } if((!is_ipaddr($old_ep)) || (! is_ipaddr($ep))) { - log_error("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '{$old_ep}' new EP '{$ep}'"); + log_error(sprintf(gettext("IPSEC: ERROR: One of the endpoints is not a IP address. Old EP '%s' new EP '%s'"), $old_ep, $ep)); } if((! is_ipaddr($rgip)) || (! is_ipaddr($old_gw))) { - log_error("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '{$old_gw}' new RG '{$rgip}'"); + log_error(sprintf(gettext("IPSEC: ERROR: One of the remote endpoints is not a IP address. Old RG '%s' new RG '%s'"), $old_gw, $rgip)); } $spdconf = ""; @@ -1697,7 +1697,7 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { "{$phase2['protocol']}/tunnel/{$rgip}-" . "{$ep}/unique;\n"; - log_error("Reloading IPsec tunnel '{$phase1['descr']}'. Previous IP '{$old_gw}', current IP '{$rgip}'. Reloading policy"); + log_error(sprintf(gettext("Reloading IPsec tunnel '%s'. Previous IP '%s', current IP '%s'. Reloading policy"), $phase1['descr'], $old_gw, $rgip)); $now = time(); $spdfile = tempnam("{$g['tmp_path']}", "spd.conf.reload.{$now}."); |