diff options
author | Warren Baker <warren@decoy.co.za> | 2011-09-29 20:58:58 +0200 |
---|---|---|
committer | Warren Baker <warren@decoy.co.za> | 2011-09-29 20:58:58 +0200 |
commit | aa5e95e3d1829d86f8f851b4d77488dc59a23a19 (patch) | |
tree | 891a074554306bb87c26a67696d3aee06aa6178b /config/unbound | |
parent | f956b613ddbf967e736902ac2b60d337e4d94a44 (diff) | |
download | pfsense-packages-aa5e95e3d1829d86f8f851b4d77488dc59a23a19.tar.gz pfsense-packages-aa5e95e3d1829d86f8f851b4d77488dc59a23a19.tar.bz2 pfsense-packages-aa5e95e3d1829d86f8f851b4d77488dc59a23a19.zip |
Add function to determine next available ACL id and replace spaces with _ for acl actions
Diffstat (limited to 'config/unbound')
-rw-r--r-- | config/unbound/unbound.inc | 21 |
1 files changed, 21 insertions, 0 deletions
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 |