You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2020/07/30 19:40:39 UTC
[qpid-dispatch] branch master updated: DISPATCH-1732: Policy
multitenant vhost check if Open.hostname is absent
This is an automated email from the ASF dual-hosted git repository.
chug pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 8dd77e3 DISPATCH-1732: Policy multitenant vhost check if Open.hostname is absent
8dd77e3 is described below
commit 8dd77e3e56ba55a3b48dd3bb225fdff7bfd6d2cc
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Thu Jul 30 15:36:06 2020 -0400
DISPATCH-1732: Policy multitenant vhost check if Open.hostname is absent
Null hostname causes segfault. Add self test to verify fix.
---
src/policy.c | 2 +-
tests/system_tests_policy.py | 58 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/src/policy.c b/src/policy.c
index ae093b1..7486dd7 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -1294,7 +1294,7 @@ void qd_policy_amqp_open(qd_connection_t *qd_conn) {
if (cf && cf->multi_tenant) {
char vhost_name_buf[SETTINGS_NAME_SIZE];
if (qd_policy_lookup_vhost_alias(policy, vhost, vhost_name_buf, SETTINGS_NAME_SIZE)) {
- if (!strcmp(pcrh, vhost_name_buf)) {
+ if (pcrh && !strcmp(pcrh, vhost_name_buf)) {
// Default condition: use proton connection value; no action here
} else {
// Policy used a name different from what came in the AMQP Open hostname.
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index ca8a57d..49cc901 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -1992,5 +1992,63 @@ class PolicyVhostAlias(TestCase):
self.assertTrue(test.error is None)
+class PolicyVhostMultiTenantBlankHostname(TestCase):
+ """
+ DISPATCH-1732: verify that a multitenant listener can handle an Open
+ with no hostname field.
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ """Start the router"""
+ super(PolicyVhostMultiTenantBlankHostname, cls).setUpClass()
+
+ def router(name, mode, extra=None):
+ config = [
+ ('router', {'mode': mode,
+ 'id': name}),
+ ('listener', {'role': 'normal',
+ 'multiTenant': 'true',
+ 'port': cls.tester.get_port(),
+ 'policyVhost': 'myhost'}),
+ ('policy', {'enableVhostPolicy': 'true'}),
+ ('vhost', {'hostname': 'myhost',
+ 'allowUnknownUser': 'true',
+ 'groups': {
+ '$default': {
+ 'users': '*',
+ 'maxConnections': 100,
+ 'remoteHosts': '*',
+ 'sources': '*',
+ 'targets': '*',
+ 'allowAnonymousSender': 'true',
+ 'allowWaypointLinks': 'true',
+ 'allowDynamicSource': 'true'
+ }
+ }
+ })
+ ]
+
+ config = Qdrouterd.Config(config)
+ cls.routers.append(cls.tester.qdrouterd(name, config, wait=True))
+ return cls.routers[-1]
+
+ cls.routers = []
+
+ router('A', 'interior')
+ cls.INT_A = cls.routers[0]
+ cls.INT_A.listener = cls.INT_A.addresses[0]
+
+ def test_101_policy_alias_blank_vhost(self):
+ test = PolicyConnectionAliasTest(PolicyVhostMultiTenantBlankHostname.INT_A,
+ "",
+ "address-blank-101")
+ test.run()
+ if test.error is not None:
+ test.logger.log("test_101 test error: %s" % (test.error))
+ test.logger.dump()
+ self.assertTrue(test.error is None)
+
+
if __name__ == '__main__':
unittest.main(main_module())
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org