diff --git a/src/dc_securejoin.rs b/src/dc_securejoin.rs index 5e4ef74ee..b3a529b67 100644 --- a/src/dc_securejoin.rs +++ b/src/dc_securejoin.rs @@ -754,65 +754,59 @@ pub unsafe fn dc_handle_securejoin_handshake( ok_to_continue = true; } if ok_to_continue { - if 0 == mark_peer_as_verified( + if 0 == mark_peer_as_verified(context, &scanned_fingerprint_of_alice) { + could_not_establish_secure_connection( context, - &scanned_fingerprint_of_alice, - ) { - could_not_establish_secure_connection( + contact_chat_id, + b"Fingerprint mismatch on joiner-side.\x00" as *const u8 + as *const libc::c_char, + ); + ok_to_continue = false; + } else { + Contact::scaleup_origin_by_id( + context, + contact_id, + Origin::SecurejoinJoined, + ); + context.call_cb( + Event::CONTACTS_CHANGED, + 0i32 as uintptr_t, + 0i32 as uintptr_t, + ); + if 0 != join_vg { + if !addr_equals_self( context, - contact_chat_id, - b"Fingerprint mismatch on joiner-side.\x00" as *const u8 - as *const libc::c_char, - ); - ok_to_continue = false; - } else { - Contact::scaleup_origin_by_id( - context, - contact_id, - Origin::SecurejoinJoined, - ); - context.call_cb( - Event::CONTACTS_CHANGED, - 0i32 as uintptr_t, - 0i32 as uintptr_t, - ); - if 0 != join_vg { - if !addr_equals_self( - context, - as_str(lookup_field( - mimeparser, - "Chat-Group-Member-Added", - )), - ) { - info!( + as_str(lookup_field(mimeparser, "Chat-Group-Member-Added")), + ) { + info!( context, 0, "Message belongs to a different handshake (scaled up contact anyway to allow creation of group)." ); - ok_to_continue = false; - } else { - ok_to_continue = true; - } + ok_to_continue = false; } else { ok_to_continue = true; } - if ok_to_continue { - secure_connection_established(context, contact_chat_id); - context.bob.write().unwrap().expects = 0; - if 0 != join_vg { - send_handshake_msg( - context, - contact_chat_id, - b"vg-member-added-received\x00" as *const u8 - as *const libc::c_char, - "", - ptr::null(), - "", - ); - } - end_bobs_joining(context, 1i32); - ok_to_continue = true; + } else { + ok_to_continue = true; + } + if ok_to_continue { + secure_connection_established(context, contact_chat_id); + context.bob.write().unwrap().expects = 0; + if 0 != join_vg { + send_handshake_msg( + context, + contact_chat_id, + b"vg-member-added-received\x00" as *const u8 + as *const libc::c_char, + "", + ptr::null(), + "", + ); } + end_bobs_joining(context, 1i32); + ok_to_continue = true; + } } } } @@ -851,9 +845,9 @@ pub unsafe fn dc_handle_securejoin_handshake( ok_to_continue = true; } if ok_to_continue { - if 0 != ret & 0x2i32 { - ret |= 0x4i32 - } + if 0 != ret & 0x2i32 { + ret |= 0x4i32 + } } } }