From aa5e95e3d1829d86f8f851b4d77488dc59a23a19 Mon Sep 17 00:00:00 2001 From: Warren Baker Date: Thu, 29 Sep 2011 20:58:58 +0200 Subject: Add function to determine next available ACL id and replace spaces with _ for acl actions --- config/unbound/unbound.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'config/unbound') diff --git a/config/unbound/unbound.inc b/config/unbound/unbound.inc index 6c6a814d..cec618c9 100644 --- a/config/unbound/unbound.inc +++ b/config/unbound/unbound.inc @@ -623,6 +623,7 @@ function unbound_validate($post, $type=null) { /* Validate the access lists */ if($type == "acl") { $acls = $post; + $acls['aclaction'] = preg_replace(" ", "_", $acls['aclaction']); // Check to ensure values entered is an action that is in the list if ($acls['aclaction'] != 'refuse' && $acls['aclaction'] != 'allow' && $acls['aclaction'] != 'allow_snoop' && $acls['aclaction'] != 'deny') $input_errors[] = "{$acls['aclaction']} is not a valid ACL Action. Please select one of the four actions defined in the list."; @@ -861,4 +862,24 @@ function unbound_add_domain_overrides($pvt=false) { } } +function unbound_acl_id_used($id) { + global $config; + + if (is_array($config['installedpackages']['unboundacls']['config'])) + foreach ($config['installedpackages']['unboundacls']['config'] as & $acls) + if ($id == $acls['aclid']) + return true; + + return false; +} + +function unbound_get_next_id() { + + $aclid = 0; + while(unbound_acl_id_used($aclid)) + $aclid++; + + return $aclid; +} + ?> \ No newline at end of file -- cgit v1.2.3