Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
bdd00552
Commit
bdd00552
authored
Dec 15, 2011
by
Jelte Jansen
Browse files
[1414] added class check as well, and test for case-insensitivity
parent
23350205
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/zonemgr/tests/zonemgr_test.py
View file @
bdd00552
...
...
@@ -569,6 +569,14 @@ class TestZonemgrRefresh(unittest.TestCase):
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertTrue
((
"example.net."
,
"IN"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# and with case-insensitive checking
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
"Example.NeT."
,
"IN"
)])
self
.
zone_refresh
.
update_config_data
(
config
,
self
.
cc_session
)
self
.
assertTrue
((
"example.net."
,
"IN"
)
in
self
.
zone_refresh
.
_zonemgr_refresh_info
)
# Try some bad names
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
"example..net"
,
"IN"
)])
...
...
@@ -580,6 +588,17 @@ class TestZonemgrRefresh(unittest.TestCase):
self
.
assertRaises
(
ZonemgrException
,
self
.
zone_refresh
.
update_config_data
,
config
,
self
.
cc_session
)
# Try a bad class
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
"example.net"
,
"BADCLASS"
)])
self
.
assertRaises
(
ZonemgrException
,
self
.
zone_refresh
.
update_config_data
,
config
,
self
.
cc_session
)
config
[
'secondary_zones'
]
=
\
zone_list_from_name_classes
([(
"example.net"
,
""
)])
self
.
assertRaises
(
ZonemgrException
,
self
.
zone_refresh
.
update_config_data
,
config
,
self
.
cc_session
)
def
tearDown
(
self
):
sys
.
stderr
=
self
.
stderr_backup
...
...
src/bin/zonemgr/zonemgr.py.in
View file @
bdd00552
...
...
@@ -483,11 +483,17 @@ class ZonemgrRefresh:
# (then this entire method can be simplified a lot, and we
# wouldn't need direct access to the ccsession object)
if 'class' in secondary_zone:
name
_class =
(name,
secondary_zone['class']
)
rr
_class = secondary_zone['class']
else:
name_class = (name,
module_cc_session.get_default_value(
'secondary_zones/class'))
rr_class = module_cc_session.get_default_value(
'secondary_zones/class')
# Convert rr_class to and from RRClass to check its value
try:
name_class = (name, isc.dns.RRClass(rr_class).to_text())
except isc.dns.InvalidRRClass as irce:
raise ZonemgrException("Bad RR class '" +
rr_class +
"' for zone " + name)
required[name_class] = True
# Add it only if it isn't there already
if not name_class in self._zonemgr_refresh_info:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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