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
a72ef46c
Commit
a72ef46c
authored
Feb 24, 2012
by
Michal 'vorner' Vaner
Browse files
[1643] Update xfrout + test TSIG keyring is used
parent
a11e3b21
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/bin/xfrout/tests/xfrout_test.py.in
View file @
a72ef46c
...
...
@@ -28,6 +28,7 @@ from xfrout import *
import xfrout
import isc.log
import isc.acl.dns
import isc.server_common.tsig_keyring
TESTDATA_SRCDIR = os.getenv("TESTDATASRCDIR")
TSIG_KEY = TSIGKey("example.com:SFuWd/q99SzF8Yzd1QbB9g==")
...
...
@@ -1155,6 +1156,37 @@ class TestUnixSockServer(unittest.TestCase):
self.write_sock, self.read_sock = socket.socketpair()
self.unix = MyUnixSockServer()
def test_tsig_keyring(self):
"""
Check we use the global keyring when starting a request.
"""
try:
# These are just so the keyring can be started
self.unix._cc.add_remote_config_by_name = lambda name, callback: None
self.unix._cc.get_remote_config_value = lambda module, name: ([], True)
self.unix._cc.remove_remote_config = lambda name: None
isc.server_common.tsig_keyring.init_keyring(self.unix._cc)
# These are not really interesting for the test. These are just handled
# over, so strings are OK.
self.unix._guess_remote = lambda sock: "Address"
self.unix._zone_config = "Zone config"
self.unix._acl = "acl"
# This would be the handler class, but we just check it is passed
# the right parametes, so function is enough for that.
keys = isc.server_common.tsig_keyring.get_keyring()
def handler(sock, data, server, keyring, address, acl, config):
self.assertEqual("sock", sock)
self.assertEqual("data", data)
self.assertEqual(self.unix, server)
self.assertEqual(keys, keyring)
self.assertEqual("Address", address)
self.assertEqual("acl", acl)
self.assertEqual("Zone config", config)
self.unix.RequestHandlerClass = handler
self.unix.finish_request("sock", "data")
finally:
isc.server_common.tsig_keyring.deinit_keyring()
def test_guess_remote(self):
"""Test we can guess the remote endpoint when we have only the
file descriptor. This is needed, because we get only that one
...
...
@@ -1436,7 +1468,6 @@ class TestXfroutServer(unittest.TestCase):
self.assertTrue(self.xfrout_server._notifier.shutdown_called)
self.assertTrue(self.xfrout_server._cc.stopped)
if __name__== "__main__":
isc.log.resetUnitTestRootLogger()
unittest.main()
src/bin/xfrout/xfrout.py.in
View file @
a72ef46c
...
...
@@ -770,7 +770,7 @@ class UnixSockServer(socketserver_mixin.NoPollMixIn,
zone_config = self._zone_config
self._lock.release()
self.RequestHandlerClass(sock_fd, request_data, self,
isc.server_common.tsig_keyring.keyring(),
isc.server_common.tsig_keyring.
get_
keyring(),
self._guess_remote(sock_fd), acl, zone_config)
def _remove_unused_sock_file(self, sock_file):
...
...
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