BIND 10 trac980, updated. 3f47015eab1abd9c7193a9e740f794c6a718c9f7 [trac980] AND-abbreviated form
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Jun 21 11:54:13 UTC 2011
The branch, trac980 has been updated
via 3f47015eab1abd9c7193a9e740f794c6a718c9f7 (commit)
via 4064b389d13d2861083499517f51d89492156099 (commit)
from 1ab0f2e8448a20674bfb8d12d463e5b3fec3ac6e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3f47015eab1abd9c7193a9e740f794c6a718c9f7
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jun 21 13:53:46 2011 +0200
[trac980] AND-abbreviated form
commit 4064b389d13d2861083499517f51d89492156099
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Jun 21 13:36:02 2011 +0200
[trac980] OR-abbreviated form
-----------------------------------------------------------------------
Summary of changes:
src/lib/acl/loader.h | 45 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 38 insertions(+), 7 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/acl/loader.h b/src/lib/acl/loader.h
index 8f2dfda..c3400cb 100644
--- a/src/lib/acl/loader.h
+++ b/src/lib/acl/loader.h
@@ -24,6 +24,10 @@
namespace isc {
namespace acl {
+class AnyOfSpec;
+class AllOfSpec;
+template<typename Mode, typename Context> class LogicOperator;
+
/**
* \brief Exception for bad ACL specifications.
*
@@ -367,18 +371,45 @@ private:
}
if (creatorIt->second->allowListAbbreviation() &&
checkDesc->second->getType() == data::Element::list) {
- isc_throw_1(LoaderError,
- "Not implemented (OR-abbreviated form)",
- checkDesc->second);
+ // Or-abbreviated form - create an OR and put everything
+ // inside.
+ const std::vector<data::ConstElementPtr>&
+ params(checkDesc->second->listValue());
+ boost::shared_ptr<LogicOperator<AnyOfSpec, Context> >
+ oper(new LogicOperator<AnyOfSpec, Context>);
+ for (std::vector<data::ConstElementPtr>::const_iterator
+ i(params.begin());
+ i != params.end(); ++i) {
+ oper->addSubexpression(
+ creatorIt->second->create(name, *i, *this));
+ }
+ return (oper);
}
// Create the check and return it
return (creatorIt->second->create(name, checkDesc->second,
*this));
}
- default:
- isc_throw_1(LoaderError,
- "Not implemented (AND-abbreviated form)",
- description);
+ default: {
+ // This is the AND-abbreviated form. We need to create an
+ // AND (or "ALL") operator, loop trough the whole map and
+ // fill it in. We do a small trick - we create bunch of
+ // single-item maps, call this loader recursively (therefore
+ // it will get into the "case 1" branch, where there is
+ // the actual loading) and use the results to fill the map.
+ //
+ // We keep the description the same, there's nothing we could
+ // take out (we could create a new one, but that would be
+ // confusing, as it is used for error messages only).
+ boost::shared_ptr<LogicOperator<AllOfSpec, Context> >
+ oper(new LogicOperator<AllOfSpec, Context>);
+ for (Map::const_iterator i(map.begin()); i != map.end(); ++i) {
+ Map singleSubexpr;
+ singleSubexpr.insert(*i);
+ oper->addSubexpression(loadCheck(description,
+ singleSubexpr));
+ }
+ return (oper);
+ }
}
}
/**
More information about the bind10-changes
mailing list