summaryrefslogtreecommitdiff
path: root/cpp/src/qpid
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-08-09 20:19:54 +0000
committerGordon Sim <gsim@apache.org>2011-08-09 20:19:54 +0000
commit430da06964d2c5af0288b5b69274746423081870 (patch)
tree5e840ccf56acc5fdc52a520d6959610e2855d575 /cpp/src/qpid
parenta230a88666d812dd8118d81f99c4e1d788f4f2b0 (diff)
downloadqpid-python-430da06964d2c5af0288b5b69274746423081870.tar.gz
QPID-3363: prevent bind/unbind on default exchange
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1155545 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
-rw-r--r--cpp/src/qpid/broker/Broker.cpp11
-rw-r--r--cpp/src/qpid/cluster/UpdateClient.cpp6
2 files changed, 13 insertions, 4 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp
index 6eaf16b052..e02a013cd1 100644
--- a/cpp/src/qpid/broker/Broker.cpp
+++ b/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,&params))
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,&params) )
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/cpp/src/qpid/cluster/UpdateClient.cpp b/cpp/src/qpid/cluster/UpdateClient.cpp
index f306517d37..fc104e8ca9 100644
--- a/cpp/src/qpid/cluster/UpdateClient.cpp
+++ b/cpp/src/qpid/cluster/UpdateClient.cpp
@@ -402,7 +402,11 @@ void UpdateClient::updateNonExclusiveQueue(const boost::shared_ptr<broker::Queue
}
void UpdateClient::updateBinding(client::AsyncSession& s, const std::string& queue, const QueueBinding& binding) {
- s.exchangeBind(queue, binding.exchange, binding.key, binding.args);
+ if (binding.exchange.size())
+ s.exchangeBind(queue, binding.exchange, binding.key, binding.args);
+ //else its the default exchange and there is no need to replicate
+ //the binding, the creation of the queue will have done so
+ //automatically
}
void UpdateClient::updateOutputTask(const sys::OutputTask* task) {