From 20f3822c87e64505d9e78ccdc5e0a97bbee4de99 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Tue, 11 Jan 2011 14:41:18 +0200 Subject: Ensure number is not a negative. --- config/unbound/unbound.inc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'config/unbound') diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 6d178e83..cb35c81a 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -454,7 +454,12 @@ function unbound_optimization() { foreach ($config['sysctl']['item'] as $tunable) { if ($tunable['tunable'] == 'kern.ipc.maxsockbuf') { $so = floor(($tunable['value']/1024/1024)-1); - $optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m"; + // Check to ensure that the number is not a negative + if ($so > 0) + $optimization['so_rcvbuf'] = "so-rcvbuf: {$so}m"; + else + unset($optimization['so_rcvbuf']); + } } // Safety check in case kern.ipc.maxsockbuf is deleted. @@ -490,11 +495,16 @@ function fetch_root_hints() { } } -function unbound_validate($post) { +function unbound_validate($post, $acl=false) { global $config, $input_errors; - if($_POST['unbound_status'] == "on" && isset($config['dnsmasq']['enable'])) + if($post['unbound_status'] == "on" && isset($config['dnsmasq']['enable'])) $input_errors[] = "The system dns-forwarder is still active. Disable it before enabling the Unbound service."; + + if($acl) { + if(isset($post['row']['acl_network'])) + print_r($post); exit; + } } -- cgit v1.2.3