From c54d50dc73c192810fb18c415f2ab95f6bfae00d Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 9 Aug 2011 20:19:54 +0000 Subject: QPID-3363: prevent bind/unbind on default exchange git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1155545 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/broker/Broker.cpp | 11 +- qpid/cpp/src/qpid/cluster/UpdateClient.cpp | 6 +- qpid/cpp/src/tests/federation_sys.py | 282 +---------------------------- 3 files changed, 14 insertions(+), 285 deletions(-) (limited to 'qpid/cpp') diff --git a/qpid/cpp/src/qpid/broker/Broker.cpp b/qpid/cpp/src/qpid/broker/Broker.cpp index 6eaf16b052..e02a013cd1 100644 --- a/qpid/cpp/src/qpid/broker/Broker.cpp +++ b/qpid/cpp/src/qpid/broker/Broker.cpp @@ -916,6 +916,9 @@ void Broker::bind(const std::string& queueName, if (!acl->authorise(userId,acl::ACT_BIND,acl::OBJ_EXCHANGE,exchangeName,¶ms)) throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied exchange bind request from " << userId)); } + if (exchangeName.empty()) { + throw framing::NotAllowedException(QPID_MSG("Bind not allowed for default exchange")); + } Queue::shared_ptr queue = queues.find(queueName); Exchange::shared_ptr exchange = exchanges.get(exchangeName); @@ -946,13 +949,15 @@ void Broker::unbind(const std::string& queueName, if (!acl->authorise(userId,acl::ACT_UNBIND,acl::OBJ_EXCHANGE,exchangeName,¶ms) ) throw framing::UnauthorizedAccessException(QPID_MSG("ACL denied exchange unbind request from " << userId)); } - + if (exchangeName.empty()) { + throw framing::NotAllowedException(QPID_MSG("Unbind not allowed for default exchange")); + } Queue::shared_ptr queue = queues.find(queueName); Exchange::shared_ptr exchange = exchanges.get(exchangeName); if (!queue) { - throw framing::NotFoundException(QPID_MSG("Bind failed. No such queue: " << queueName)); + throw framing::NotFoundException(QPID_MSG("Unbind failed. No such queue: " << queueName)); } else if (!exchange) { - throw framing::NotFoundException(QPID_MSG("Bind failed. No such exchange: " << exchangeName)); + throw framing::NotFoundException(QPID_MSG("Unbind failed. No such exchange: " << exchangeName)); } else { if (exchange->unbind(queue, key, 0)) { if (exchange->isDurable() && queue->isDurable()) { diff --git a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp index f306517d37..fc104e8ca9 100644 --- a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp +++ b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp @@ -402,7 +402,11 @@ void UpdateClient::updateNonExclusiveQueue(const boost::shared_ptr