|
|
176b6be |
commit 939e74d3d6b2913beeb2d2718bebaab3f033577b
|
|
|
176b6be |
Author: Andreas Schlick <schlick@lavabit.com>
|
|
|
176b6be |
Date: Tue Dec 18 17:55:24 2012 +0100
|
|
|
176b6be |
|
|
|
176b6be |
Copy lastmessage to the newly created context.
|
|
|
176b6be |
|
|
|
176b6be |
This fixes a case where the first user message
|
|
|
176b6be |
gets lost when OTRL_POLICY_REQUIRE_ENCRYPTION
|
|
|
176b6be |
policy is set because after establishing the
|
|
|
176b6be |
encryption lastmessage remains with the master
|
|
|
176b6be |
context and will not be resent.
|
|
|
176b6be |
|
|
|
176b6be |
[Slightly modified by Ian Goldberg]
|
|
|
176b6be |
|
|
|
176b6be |
diff --git a/src/message.c b/src/message.c
|
|
|
176b6be |
index 7c39529..6b842bc 100644
|
|
|
176b6be |
--- a/src/message.c
|
|
|
176b6be |
+++ b/src/message.c
|
|
|
176b6be |
@@ -1078,9 +1078,14 @@ int otrl_message_receiving(OtrlUserState us, const OtrlMessageAppOps *ops,
|
|
|
176b6be |
/* Copy information from m_context to the new instance context */
|
|
|
176b6be |
context->auth.protocol_version = 3;
|
|
|
176b6be |
context->protocol_version = 3;
|
|
|
176b6be |
-
|
|
|
176b6be |
- if (context_added) {
|
|
|
176b6be |
- context->msgstate = m_context->msgstate;
|
|
|
176b6be |
+ context->msgstate = m_context->msgstate;
|
|
|
176b6be |
+
|
|
|
176b6be |
+ if (m_context->context_priv->may_retransmit) {
|
|
|
176b6be |
+ gcry_free(context->context_priv->lastmessage);
|
|
|
176b6be |
+ context->context_priv->lastmessage = m_context->context_priv->lastmessage;
|
|
|
176b6be |
+ m_context->context_priv->lastmessage = NULL;
|
|
|
176b6be |
+ context->context_priv->may_retransmit = m_context->context_priv->may_retransmit;
|
|
|
176b6be |
+ m_context->context_priv->may_retransmit = 0;
|
|
|
176b6be |
}
|
|
|
176b6be |
|
|
|
176b6be |
if (msgtype == OTRL_MSGTYPE_DH_KEY) {
|