From c361e3919f2de3f4742904b04e73178edc76bf95 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Sun, 23 Oct 2005 20:12:19 +0000 Subject: Bug #1893: Fix replies when peers use different major opcodes for the same subprotocol. (016_ICE_subprotocol_reply_fix.diff from Debian, by Jochen Voss) --- src/process.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/process.c b/src/process.c index a6823e9..2a97dcb 100644 --- a/src/process.c +++ b/src/process.c @@ -250,16 +250,33 @@ Bool *replyReadyRet; _IceAddReplyWait (iceConn, replyWait); - /* * Note that there are two different replyWaits. The first is * the one passed into IceProcessMessages, and is the replyWait * for the message the client is blocking on. The second is * the replyWait for the message currently being processed * by IceProcessMessages. We call it "useThisReplyWait". + * + * Also, when two hosts communicate over an ICE connection and use + * different major opcodes for a subprotocol, it is impossible + * to use message replies unless we translate opcodes before + * comparing them. */ + + { + int op; - useThisReplyWait = _IceSearchReplyWaits (iceConn, header->majorOpcode); + if (header->majorOpcode == 0) + { + op = 0; + } + else + { + int idx = header->majorOpcode - iceConn->his_min_opcode; + op = iceConn->process_msg_info[idx].my_opcode; + } + useThisReplyWait = _IceSearchReplyWaits (iceConn, op); + } } if (header->majorOpcode == 0) -- cgit v1.2.3