Commit 939e74d3 authored by Andreas Schlick's avatar Andreas Schlick Committed by Ian Goldberg

Copy lastmessage to the newly created context.

This fixes a case where the first user message
gets lost when OTRL_POLICY_REQUIRE_ENCRYPTION
policy is set because after establishing the
encryption lastmessage remains with the master
context and will not be resent.

[Slightly modified by Ian Goldberg]
parent 93cffe97
......@@ -1078,9 +1078,14 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
/* Copy information from m_context to the new instance context */
context->auth.protocol_version = 3;
context->protocol_version = 3;
if (context_added) {
context->msgstate = m_context->msgstate;
context->msgstate = m_context->msgstate;
if (m_context->context_priv->may_retransmit) {
gcry_free(context->context_priv->lastmessage);
context->context_priv->lastmessage = m_context->context_priv->lastmessage;
m_context->context_priv->lastmessage = NULL;
context->context_priv->may_retransmit = m_context->context_priv->may_retransmit;
m_context->context_priv->may_retransmit = 0;
}
if (msgtype == OTRL_MSGTYPE_DH_KEY) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment