You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2015/06/24 20:23:29 UTC
qpid-proton git commit: PROTON-920: checks for valid channel and
handle
Repository: qpid-proton
Updated Branches:
refs/heads/master f6460791a -> 6e7e04d2e
PROTON-920: checks for valid channel and handle
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6e7e04d2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6e7e04d2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6e7e04d2
Branch: refs/heads/master
Commit: 6e7e04d2e4d554ba5515aa07f3d05203edbfa3de
Parents: f646079
Author: Gordon Sim <gs...@redhat.com>
Authored: Wed Jun 24 19:25:19 2015 +0100
Committer: Gordon Sim <gs...@redhat.com>
Committed: Wed Jun 24 19:25:33 2015 +0100
----------------------------------------------------------------------
proton-c/src/transport/transport.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6e7e04d2/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index ff80e21..4cf935b 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -1279,7 +1279,7 @@ int pn_do_attach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
pn_session_t *ssn = pni_channel_state(transport, channel);
if (!ssn) {
- pn_do_error(transport, "amqp:connection:no-session", "attach without a session");
+ pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
if (strheap) free(strheap);
return PN_EOS;
}
@@ -1395,12 +1395,18 @@ int pn_do_transfer(pn_transport_t *transport, uint8_t frame_type, uint16_t chann
&settled, &more, &has_type, &type, transport->disp_data);
if (err) return err;
pn_session_t *ssn = pni_channel_state(transport, channel);
+ if (!ssn) {
+ return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
+ }
if (!ssn->state.incoming_window) {
return pn_do_error(transport, "amqp:session:window-violation", "incoming session window exceeded");
}
pn_link_t *link = pni_handle_state(ssn, handle);
+ if (!link) {
+ return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
+ }
pn_delivery_t *delivery;
if (link->unsettled_tail && !link->unsettled_tail->done) {
delivery = link->unsettled_tail;
@@ -1465,6 +1471,9 @@ int pn_do_flow(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
if (err) return err;
pn_session_t *ssn = pni_channel_state(transport, channel);
+ if (!ssn) {
+ return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
+ }
if (inext_init) {
ssn->state.remote_incoming_window = inext + iwin - ssn->state.outgoing_transfer_count;
@@ -1474,6 +1483,9 @@ int pn_do_flow(pn_transport_t *transport, uint8_t frame_type, uint16_t channel,
if (handle_init) {
pn_link_t *link = pni_handle_state(ssn, handle);
+ if (!link) {
+ return pn_do_error(transport, "amqp:invalid-field", "no such handle: %u", handle);
+ }
if (link->endpoint.type == SENDER) {
pn_sequence_t receiver_count;
if (dcount_init) {
@@ -1535,6 +1547,10 @@ int pn_do_disposition(pn_transport_t *transport, uint8_t frame_type, uint16_t ch
if (!last_init) last = first;
pn_session_t *ssn = pni_channel_state(transport, channel);
+ if (!ssn) {
+ return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
+ }
+
pn_delivery_map_t *deliveries;
if (role) {
deliveries = &ssn->state.outgoing;
@@ -1608,7 +1624,7 @@ int pn_do_detach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
pn_session_t *ssn = pni_channel_state(transport, channel);
if (!ssn) {
- return pn_do_error(transport, "amqp:invalid-field", "no such channel: %u", channel);
+ return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
}
pn_link_t *link = pni_handle_state(ssn, handle);
if (!link) {
@@ -1633,6 +1649,9 @@ int pn_do_detach(pn_transport_t *transport, uint8_t frame_type, uint16_t channel
int pn_do_end(pn_transport_t *transport, uint8_t frame_type, uint16_t channel, pn_data_t *args, const pn_bytes_t *payload)
{
pn_session_t *ssn = pni_channel_state(transport, channel);
+ if (!ssn) {
+ return pn_do_error(transport, "amqp:not-allowed", "no such channel: %u", channel);
+ }
int err = pn_scan_error(args, &ssn->endpoint.remote_condition, SCAN_ERROR_DEFAULT);
if (err) return err;
PN_SET_REMOTE(ssn->endpoint.state, PN_REMOTE_CLOSED);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org