Blame SOURCES/pptp-1.7.2-call-disconnect-notify.patch

27639a
Fix broken Call-Disconnect-Notify code
27639a
Submitted upstream: http://marc.info/?l=pptpclient-devel&m=128594487715881&w=1
27639a
27639a
--- pptp-1.7.2/pptp_ctrl.c	2010-11-30 15:26:29.856391644 +0000
27639a
+++ pptp-1.7.2/pptp_ctrl.c	2010-11-30 15:26:29.861391766 +0000
27639a
@@ -941,15 +941,25 @@ int ctrlp_disp(PPTP_CONN * conn, void * 
27639a
         {
27639a
             struct pptp_call_clear_ntfy *packet =
27639a
                 (struct pptp_call_clear_ntfy *)buffer;
27639a
+            int i;
27639a
+            u_int16_t our_call_id;
27639a
+            u_int16_t peer_call_id = ntoh16(packet->call_id);
27639a
             log("Call disconnect notification received (call id %d)",
27639a
-                    ntoh16(packet->call_id));
27639a
-            if (vector_contains(conn->call, ntoh16(packet->call_id))) {
27639a
-                PPTP_CALL * call;
27639a
-                ctrlp_error(packet->result_code, packet->error_code,
27639a
-                        packet->cause_code, pptp_call_disc_ntfy,
27639a
-                        MAX_CALL_DISC_NTFY);
27639a
-                vector_search(conn->call, ntoh16(packet->call_id), &call);
27639a
-                pptp_call_destroy(conn, call);
27639a
+                (int) peer_call_id);
27639a
+            /* See if we can map the peer's call id to our own */
27639a
+            for (i = 0; i < vector_size(conn->call); i++) {
27639a
+                PPTP_CALL * call = vector_get_Nth(conn->call, i);
27639a
+                if (call->peer_call_id == peer_call_id) {
27639a
+                    our_call_id = call->call_id;
27639a
+                    if (vector_contains(conn->call, our_call_id)) {
27639a
+                        ctrlp_error(packet->result_code, packet->error_code,
27639a
+                            packet->cause_code, pptp_call_disc_ntfy,
27639a
+                            MAX_CALL_DISC_NTFY);
27639a
+                        vector_search(conn->call, our_call_id, &call);
27639a
+                        pptp_call_destroy(conn, call);
27639a
+                    }
27639a
+                    break;
27639a
+                }
27639a
             }
27639a
             /* XXX we could log call stats here XXX */
27639a
             /* XXX not all servers send this XXX */