Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
69dfb454
Commit
69dfb454
authored
Apr 25, 2013
by
JINMEI Tatuya
Browse files
[master] Merge branch 'trac2887'
parents
c66811b7
3b1551b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/lib/datasrc/memory/rdataset.cc
View file @
69dfb454
...
...
@@ -28,7 +28,6 @@
#include <stdint.h>
#include <algorithm>
#include <cstring>
#include <typeinfo> // for bad_cast
#include <new> // for the placement new
using
namespace
isc
::
dns
;
...
...
@@ -41,13 +40,12 @@ namespace memory {
namespace
{
RRType
getCoveredType
(
const
Rdata
&
rdata
)
{
try
{
const
generic
::
RRSIG
&
rrsig_rdata
=
dynamic_cast
<
const
generic
::
RRSIG
&>
(
rdata
);
return
(
rrsig_rdata
.
typeCovered
());
}
catch
(
const
std
::
bad_cast
&
)
{
const
generic
::
RRSIG
*
rrsig_rdata
=
dynamic_cast
<
const
generic
::
RRSIG
*>
(
&
rdata
);
if
(
!
rrsig_rdata
)
{
isc_throw
(
BadValue
,
"Non RRSIG is given where it's expected"
);
}
return
(
rrsig_rdata
->
typeCovered
());
}
// A helper for lowestTTL: restore RRTTL object from wire-format 32-bit data.
...
...
src/lib/dns/python/rrset_python.cc
View file @
69dfb454
...
...
@@ -293,8 +293,16 @@ RRset_addRdata(PyObject* self, PyObject* args) {
PyErr_Clear
();
PyErr_SetString
(
PyExc_TypeError
,
"Rdata type to add must match type of RRset"
);
return
(
NULL
);
}
catch
(
const
exception
&
ex
)
{
const
string
ex_what
=
"Unexpected failure adding rrset Rdata: "
+
string
(
ex
.
what
());
PyErr_SetString
(
po_IscException
,
ex_what
.
c_str
());
}
catch
(...)
{
PyErr_SetString
(
PyExc_SystemError
,
"Unexpected failure adding rrset Rdata"
);
}
return
(
NULL
);
}
PyObject
*
...
...
src/lib/dns/python/tests/rrset_python_test.py
View file @
69dfb454
...
...
@@ -78,7 +78,12 @@ class TestModuleSpec(unittest.TestCase):
def
test_add_rdata
(
self
):
# no iterator to read out yet (TODO: add addition test once implemented)
self
.
assertRaises
(
TypeError
,
self
.
rrset_a
.
add_rdata
,
# This should result in TypeError, but FreeBSD 9.1 cannot correctly
# catch the expected internal C++ exception, resulting in SystemError.
# In general it's not a good practice to weaken the test condition for
# a limited set of buggy environment, but this seems to be the only
# case it could fail this way, so we'd live with it. See #2887.
self
.
assertRaises
((
TypeError
,
SystemError
),
self
.
rrset_a
.
add_rdata
,
Rdata
(
RRType
(
"NS"
),
RRClass
(
"IN"
),
"test.name."
))
def
test_to_text
(
self
):
...
...
src/lib/dns/tsigrecord.cc
View file @
69dfb454
...
...
@@ -59,13 +59,14 @@ namespace {
// of the constructor below.
const
any
::
TSIG
&
castToTSIGRdata
(
const
rdata
::
Rdata
&
rdata
)
{
try
{
return
(
dynamic_cast
<
const
any
::
TSIG
&
>
(
rdata
)
)
;
}
catch
(
std
::
bad_cast
&
)
{
const
any
::
TSIG
*
tsig_rdata
=
dynamic_cast
<
const
any
::
TSIG
*
>
(
&
rdata
);
if
(
!
tsig_rdata
)
{
isc_throw
(
DNSMessageFORMERR
,
"TSIG record is being constructed from "
"incompatible RDATA:"
<<
rdata
.
toText
());
}
return
(
*
tsig_rdata
);
}
}
...
...
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