mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Merge pull request #1212 from deltachat/handshake-ignore
do not delete handshake messages possibly belonging to secure-joins on other devices
This commit is contained in:
@@ -623,26 +623,27 @@ pub(crate) fn handle_securejoin_handshake(
|
|||||||
==== Bob - the joiner's side ====
|
==== Bob - the joiner's side ====
|
||||||
==== Step 7 in "Setup verified contact" protocol ====
|
==== Step 7 in "Setup verified contact" protocol ====
|
||||||
=======================================================*/
|
=======================================================*/
|
||||||
let ret = if join_vg {
|
let abort_retval = if join_vg {
|
||||||
HandshakeMessage::Propagate
|
HandshakeMessage::Propagate
|
||||||
} else {
|
} else {
|
||||||
HandshakeMessage::Done
|
HandshakeMessage::Ignore
|
||||||
};
|
};
|
||||||
|
|
||||||
if context.bob.read().unwrap().expects != DC_VC_CONTACT_CONFIRM {
|
if context.bob.read().unwrap().expects != DC_VC_CONTACT_CONFIRM {
|
||||||
info!(context, "Message belongs to a different handshake.",);
|
info!(context, "Message belongs to a different handshake.",);
|
||||||
return Ok(ret);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
let cond = {
|
let cond = {
|
||||||
let bob = context.bob.read().unwrap();
|
let bob = context.bob.read().unwrap();
|
||||||
let scan = bob.qr_scan.as_ref();
|
let scan = bob.qr_scan.as_ref();
|
||||||
scan.is_none() || join_vg && scan.unwrap().state != LotState::QrAskVerifyGroup
|
scan.is_none() || (join_vg && scan.unwrap().state != LotState::QrAskVerifyGroup)
|
||||||
};
|
};
|
||||||
if cond {
|
if cond {
|
||||||
warn!(
|
warn!(
|
||||||
context,
|
context,
|
||||||
"Message out of sync or belongs to a different handshake.",
|
"Message out of sync or belongs to a different handshake.",
|
||||||
);
|
);
|
||||||
return Ok(ret);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
let scanned_fingerprint_of_alice = get_qr_attr!(context, fingerprint).to_string();
|
let scanned_fingerprint_of_alice = get_qr_attr!(context, fingerprint).to_string();
|
||||||
|
|
||||||
@@ -673,7 +674,7 @@ pub(crate) fn handle_securejoin_handshake(
|
|||||||
"Contact confirm message not encrypted.",
|
"Contact confirm message not encrypted.",
|
||||||
);
|
);
|
||||||
context.bob.write().unwrap().status = 0;
|
context.bob.write().unwrap().status = 0;
|
||||||
return Ok(ret);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
if mark_peer_as_verified(context, &scanned_fingerprint_of_alice).is_err() {
|
if mark_peer_as_verified(context, &scanned_fingerprint_of_alice).is_err() {
|
||||||
@@ -682,7 +683,7 @@ pub(crate) fn handle_securejoin_handshake(
|
|||||||
contact_chat_id,
|
contact_chat_id,
|
||||||
"Fingerprint mismatch on joiner-side.",
|
"Fingerprint mismatch on joiner-side.",
|
||||||
);
|
);
|
||||||
return Ok(ret);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
Contact::scaleup_origin_by_id(context, contact_id, Origin::SecurejoinJoined);
|
Contact::scaleup_origin_by_id(context, contact_id, Origin::SecurejoinJoined);
|
||||||
emit_event!(context, Event::ContactsChanged(None));
|
emit_event!(context, Event::ContactsChanged(None));
|
||||||
@@ -696,7 +697,7 @@ pub(crate) fn handle_securejoin_handshake(
|
|||||||
.map_err(|_| HandshakeError::NoSelfAddr)?
|
.map_err(|_| HandshakeError::NoSelfAddr)?
|
||||||
{
|
{
|
||||||
info!(context, "Message belongs to a different handshake (scaled up contact anyway to allow creation of group).");
|
info!(context, "Message belongs to a different handshake (scaled up contact anyway to allow creation of group).");
|
||||||
return Ok(ret);
|
return Ok(abort_retval);
|
||||||
}
|
}
|
||||||
secure_connection_established(context, contact_chat_id);
|
secure_connection_established(context, contact_chat_id);
|
||||||
context.bob.write().unwrap().expects = 0;
|
context.bob.write().unwrap().expects = 0;
|
||||||
@@ -713,7 +714,11 @@ pub(crate) fn handle_securejoin_handshake(
|
|||||||
}
|
}
|
||||||
context.bob.write().unwrap().status = 1;
|
context.bob.write().unwrap().status = 1;
|
||||||
context.stop_ongoing();
|
context.stop_ongoing();
|
||||||
Ok(ret)
|
Ok(if join_vg {
|
||||||
|
HandshakeMessage::Propagate
|
||||||
|
} else {
|
||||||
|
HandshakeMessage::Done
|
||||||
|
})
|
||||||
}
|
}
|
||||||
"vg-member-added-received" => {
|
"vg-member-added-received" => {
|
||||||
/*==========================================================
|
/*==========================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user