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
Sebastian Schrader
Kea
Commits
429d200e
Commit
429d200e
authored
Jun 03, 2013
by
JINMEI Tatuya
Browse files
[2964] cleanup: removed any reference to db_file command params
parent
4ca40253
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/xfrin/tests/xfrin_test.py
View file @
429d200e
...
...
@@ -281,24 +281,20 @@ class MockXfrin(Xfrin):
def
_cc_setup
(
self
):
self
.
_module_cc
=
MockCC
()
def
_get_db_file
(
self
):
pass
def
_cc_check_command
(
self
):
self
.
_shutdown_event
.
set
()
if
MockXfrin
.
check_command_hook
:
MockXfrin
.
check_command_hook
()
def
xfrin_start
(
self
,
zone_name
,
rrclass
,
db_file
,
master_addrinfo
,
def
xfrin_start
(
self
,
zone_name
,
rrclass
,
master_addrinfo
,
tsig_key
,
request_ixfr
,
check_soa
=
True
):
# store some of the arguments for verification, then call this
# method in the superclass
self
.
xfrin_started_master_addr
=
master_addrinfo
[
2
][
0
]
self
.
xfrin_started_master_port
=
master_addrinfo
[
2
][
1
]
self
.
xfrin_started_request_ixfr
=
request_ixfr
return
Xfrin
.
xfrin_start
(
self
,
zone_name
,
rrclass
,
None
,
master_addrinfo
,
tsig_key
,
request_ixfr
,
check_soa
)
return
Xfrin
.
xfrin_start
(
self
,
zone_name
,
rrclass
,
master_addrinfo
,
tsig_key
,
request_ixfr
,
check_soa
)
class
MockXfrinConnection
(
XfrinConnection
):
def
__init__
(
self
,
sock_map
,
zone_name
,
rrclass
,
datasrc_client
,
...
...
@@ -2459,7 +2455,6 @@ class TestXfrin(unittest.TestCase):
self
.
args
[
'class'
]
=
TEST_RRCLASS_STR
self
.
args
[
'port'
]
=
TEST_MASTER_PORT
self
.
args
[
'master'
]
=
TEST_MASTER_IPV4_ADDRESS
self
.
args
[
'db_file'
]
=
TEST_DB_FILE
self
.
args
[
'tsig_key'
]
=
''
def
tearDown
(
self
):
...
...
@@ -2487,12 +2482,10 @@ class TestXfrin(unittest.TestCase):
def
test_parse_cmd_params
(
self
):
name
,
rrclass
=
self
.
_do_parse_zone_name_class
()
master_addrinfo
=
self
.
_do_parse_master_port
()
db_file
=
self
.
args
.
get
(
'db_file'
)
self
.
assertEqual
(
master_addrinfo
[
2
][
1
],
int
(
TEST_MASTER_PORT
))
self
.
assertEqual
(
name
,
TEST_ZONE_NAME
)
self
.
assertEqual
(
rrclass
,
TEST_RRCLASS
)
self
.
assertEqual
(
master_addrinfo
[
2
][
0
],
TEST_MASTER_IPV4_ADDRESS
)
self
.
assertEqual
(
db_file
,
TEST_DB_FILE
)
def
test_parse_cmd_params_default_port
(
self
):
del
self
.
args
[
'port'
]
...
...
src/bin/xfrin/xfrin.py.in
View file @
429d200e
...
...
@@ -1524,7 +1524,7 @@ class Xfrin:
self._module_cc.get_default_value("zones/request_ixfr")
return ZoneInfo.REQUEST_IXFR_CFG_TO_VAL[request_ixfr_def]
def __handle_xfr_command(self, args,
arg_db,
check_soa, addr_validator,
def __handle_xfr_command(self, args, check_soa, addr_validator,
request_ixfr):
"""Common subroutine for handling transfer commands.
...
...
@@ -1550,14 +1550,13 @@ class Xfrin:
master_addr = self._parse_master_and_port(args, zone_name, rrclass)
zone_info = self._get_zone_info(zone_name, rrclass)
tsig_key = None if zone_info is None else zone_info.get_tsig_key()
db_file = arg_db or self._get_db_file()
zone_str = format_zone_str(zone_name, rrclass) # for logging
answer = addr_validator(master_addr, zone_str, zone_info)
if answer is not None:
return answer
request_ixfr = self.__get_running_request_ixfr(request_ixfr, zone_info)
ret = self.xfrin_start(zone_name, rrclass,
db_file,
master_addr,
tsig_key,
request_ixfr, check_soa)
ret = self.xfrin_start(zone_name, rrclass, master_addr,
tsig_key,
request_ixfr, check_soa)
return create_answer(ret[0], ret[1])
def command_handler(self, command, args):
...
...
@@ -1568,25 +1567,23 @@ class Xfrin:
self._shutdown_event.set()
elif command == 'notify' or command == REFRESH_FROM_ZONEMGR:
# refresh/notify command from zone manager.
# The address has to be validated, db_file is local only,
# and always perform SOA check.
# The address has to be validated and always perform SOA check.
addr_validator = \
lambda x, y, z: self.__validate_notify_addr(x, y, z)
answer = self.__handle_xfr_command(args,
None, True
,
addr_validator,
None)
answer = self.__handle_xfr_command(args,
True, addr_validator
,
None)
elif command == 'retransfer':
# retransfer from cmdctl (sent by bindctl).
# No need for address validation,
db_file may be specified
#
with the command, and skip SOA check, always
use AXFR.
# No need for address validation,
skip SOA check, and always
# use AXFR.
answer = self.__handle_xfr_command(
args,
args.get('db_file'),
False, lambda x, y, z: None,
args, False, lambda x, y, z: None,
ZoneInfo.REQUEST_IXFR_DISABLED)
elif command == 'refresh':
# retransfer from cmdctl (sent by bindctl). similar to
# retransfer, but do SOA check, and honor request_ixfr config.
answer = self.__handle_xfr_command(
args, args.get('db_file'), True, lambda x, y, z: None,
None)
args, True, lambda x, y, z: None, None)
# return statistics data to the stats daemon
elif command == "getstats":
# The log level is here set to debug in order to avoid
...
...
@@ -1650,9 +1647,6 @@ class Xfrin:
return (addr.family, socket.SOCK_STREAM, (str(addr), port))
def _get_db_file(self):
return self._db_file
def publish_xfrin_news(self, zone_name, zone_class, xfr_result):
'''Send command to xfrout/zone manager module.
If xfrin has finished successfully for one zone, tell the good
...
...
@@ -1712,8 +1706,8 @@ class Xfrin:
while not self._shutdown_event.is_set():
self._cc_check_command()
def xfrin_start(self, zone_name, rrclass,
db_file,
master_addrinfo,
tsig_key,
request_ixfr, check_soa=True):
def xfrin_start(self, zone_name, rrclass, master_addrinfo,
tsig_key,
request_ixfr, check_soa=True):
if "pydnspp" not in sys.modules:
return (1,
"xfrin failed, can't load dns message python library: " +
...
...
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