Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
0e2ef3c7
Commit
0e2ef3c7
authored
Dec 12, 2012
by
JINMEI Tatuya
Browse files
[2470] check and reject ampty add-RRset callback.
parent
822fa315
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/lib/dns/rrcollator.cc
View file @
0e2ef3c7
...
...
@@ -12,6 +12,8 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <exceptions/exceptions.h>
#include <dns/name.h>
#include <dns/rdataclass.h>
#include <dns/rrcollator.h>
...
...
@@ -34,7 +36,11 @@ public:
Impl
(
const
AddRRsetCallback
&
callback
,
const
MasterLoaderCallbacks
&
issue_callback
)
:
callback_
(
callback
),
issue_callback_
(
issue_callback
)
{}
{
if
(
!
callback_
)
{
isc_throw
(
InvalidParameter
,
"Empty add RRset callback"
);
}
}
void
addRR
(
const
Name
&
name
,
const
RRClass
&
rrclass
,
const
RRType
&
rrtype
,
const
RRTTL
&
rrttl
,
...
...
src/lib/dns/rrcollator.h
View file @
0e2ef3c7
...
...
@@ -63,6 +63,8 @@ public:
/// \brief Constructor.
///
/// \c callback must not be an empty functor.
///
/// If the optional issue_callback parameter is given, it will be used
/// to report any errors and non fatal warnings found in the collator's
/// operation. By default special callbacks that do nothing are used.
...
...
@@ -74,6 +76,7 @@ public:
/// "<unknown source>" for the source name and the line number of 0 via
/// the callback.
///
/// \throw isc::InvalidParameter Empty RRset callback is given.
/// \throw std::bad_alloc Internal memory allocation fails. This should
/// be very rare.
///
...
...
src/lib/dns/tests/rrcollator_unittest.cc
View file @
0e2ef3c7
...
...
@@ -237,6 +237,11 @@ TEST_F(RRCollatorTest, throwFromCallback) {
checkRRset
(
origin_
,
rrclass_
,
RRType
::
A
(),
rrttl_
,
rdatas_
);
}
TEST_F
(
RRCollatorTest
,
emptyCallback
)
{
const
AddRRsetCallback
empty_callback
;
EXPECT_THROW
(
RRCollator
collator
(
empty_callback
),
isc
::
InvalidParameter
);
}
TEST_F
(
RRCollatorTest
,
withMasterLoader
)
{
// Test a simple case with MasterLoader. There shouldn't be anything
// special, but that's the mainly intended usage of the collator, so we
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment