[Pkg-privacy-commits] [libotr] 119/225: Copy lastmessage to the newly created context.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository libotr.

commit 939e74d3d6b2913beeb2d2718bebaab3f033577b
Author: Andreas Schlick <schlick at lavabit.com>
Date:   Tue Dec 18 17:55:24 2012 +0100

    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]
---
 src/message.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/message.c b/src/message.c
index 7c39529..6b842bc 100644
--- a/src/message.c
+++ b/src/message.c
@@ -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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git



More information about the Pkg-privacy-commits mailing list