diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-01-05 15:41:38 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-01-05 15:41:38 -0200 |
commit | 0a23cddced057d929c53f3ad1e5d6898a3fada50 (patch) | |
tree | 4d6eaf1781ab55af6ae643367d89533a60088ba6 | |
parent | 24149c31763abff0f25da381c58b22e6f9c44658 (diff) | |
download | pfsense-0a23cddced057d929c53f3ad1e5d6898a3fada50.zip pfsense-0a23cddced057d929c53f3ad1e5d6898a3fada50.tar.gz |
Fix #4090:
- Unbound advanced options may contain double quotes and it breaks the
syntax when a backup is restored because newlines are trimmed. Save it
in base64 format is a safe way to prevent it
- Bump config version to 11.5
- Provide upgrade code to encode current config or the one that came
from unbound package on 2.1.5
-rw-r--r-- | conf.default/config.xml | 2 | ||||
-rw-r--r-- | etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | etc/inc/unbound.inc | 2 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 7 | ||||
-rw-r--r-- | usr/local/www/services_unbound.php | 4 |
5 files changed, 12 insertions, 5 deletions
diff --git a/conf.default/config.xml b/conf.default/config.xml index f9d4bbc..5c0b484 100644 --- a/conf.default/config.xml +++ b/conf.default/config.xml @@ -1,6 +1,6 @@ <?xml version="1.0"?> <pfsense> - <version>11.4</version> + <version>11.5</version> <lastchange/> <theme>pfsense_ng</theme> <system> diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index ae7352f..67c33ce 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -73,7 +73,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "11.4", + "latest_config" => "11.5", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/unbound.inc b/etc/inc/unbound.inc index 1bd2f7e..496ca66 100644 --- a/etc/inc/unbound.inc +++ b/etc/inc/unbound.inc @@ -205,7 +205,7 @@ EOF; // Add custom Unbound options if ($config['unbound']['custom_options']) { - $custom_options_source = explode("\n", $config['unbound']['custom_options']); + $custom_options_source = explode("\n", base64_decode($config['unbound']['custom_options'])); $custom_options = "# Unbound custom options\n"; foreach ($custom_options_source as $ent) $custom_options .= $ent."\n"; diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 324e51e..72fc80f 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -3532,4 +3532,11 @@ function upgrade_113_to_114() { $ph1ent['iketype'] = 'ikev1'; } +function upgrade_114_to_115() { + global $config; + + if (isset($config['unbound']['custom_options'])) + $config['unbound']['custom_options'] = base64_encode($config['unbound']['custom_options']); +} + ?> diff --git a/usr/local/www/services_unbound.php b/usr/local/www/services_unbound.php index 52d976d..2b943dd 100644 --- a/usr/local/www/services_unbound.php +++ b/usr/local/www/services_unbound.php @@ -81,7 +81,7 @@ if (isset($config['unbound']['txtsupport'])) { } $pconfig['port'] = $config['unbound']['port']; -$pconfig['custom_options'] = $config['unbound']['custom_options']; +$pconfig['custom_options'] = base64_decode($config['unbound']['custom_options']); if (empty($config['unbound']['active_interface'])) { $pconfig['active_interface'] = array(); @@ -171,7 +171,7 @@ if ($_POST) { $a_unboundcfg['outgoing_interface'] = implode(",", $_POST['outgoing_interface']); } - $a_unboundcfg['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']); + $a_unboundcfg['custom_options'] = base64_encode(str_replace("\r\n", "\n", $_POST['custom_options'])); if (!$input_errors) { write_config("DNS Resolver configured."); |