[Pkg-privacy-commits] [libotr] 18/225: * src/context.h: * src/context.c: Added protocol_version as an explicit field in the ConnContext.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:44:46 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 08ebff99d1e1fc327a9b51d1dbe9d773165be19f
Author: cypherpunk <cypherpunk>
Date:   Wed Oct 19 17:24:55 2005 +0000

    	* src/context.h:
    	* src/context.c: Added protocol_version as an explicit field in
    	the ConnContext.
    
    	* src/message.h:
    	* src/message.c: protocol_version no longer needs to be
    	explicitly passed to the gone_secure() and still_secure()
    	callbacks.
---
 ChangeLog     |  9 +++++++++
 src/context.c |  2 ++
 src/context.h |  2 ++
 src/message.c |  8 ++++----
 src/message.h | 13 ++++---------
 src/tests.c   | 12 +++++-------
 6 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ae388d1..6c6f8ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2005-10-19
 
+	* src/context.h:
+	* src/context.c: Added protocol_version as an explicit field in
+	the ConnContext.
+
+	* src/message.h:
+	* src/message.c: protocol_version no longer needs to be
+	explicitly passed to the gone_secure() and still_secure()
+	callbacks.
+
 	* packaging/fedora/libotr.spec: Patches from Paul
 
 	* src/proto.c (rotate_dh_keys): Avoid potential double
diff --git a/src/context.c b/src/context.c
index 2e699c6..3205d3b 100644
--- a/src/context.c
+++ b/src/context.c
@@ -64,6 +64,7 @@ static ConnContext * new_context(const char * user, const char * accountname,
     otrl_dh_session_blank(&(context->sesskeys[1][1]));
     memset(context->sessionid, 0, 20);
     context->sessionid_len = 0;
+    context->protocol_version = 0;
     context->numsavedkeys = 0;
     context->preshared_secret = NULL;
     context->preshared_secret_len = 0;
@@ -213,6 +214,7 @@ void otrl_context_force_finished(ConnContext *context)
     free(context->preshared_secret);
     context->preshared_secret = NULL;
     context->preshared_secret_len = 0;
+    context->protocol_version = 0;
     context->numsavedkeys = 0;
     free(context->saved_mac_keys);
     context->saved_mac_keys = NULL;
diff --git a/src/context.h b/src/context.h
index 640c953..c71f95d 100644
--- a/src/context.h
+++ b/src/context.h
@@ -92,6 +92,8 @@ typedef struct context {
     size_t sessionid_len;              /* determined when this private */
     OtrlSessionIdHalf sessionid_half;  /* connection was established. */
 
+    unsigned int protocol_version;     /* The version of OTR in use */
+
     unsigned char *preshared_secret;   /* A secret you share with this
 					  user, in order to do
 					  authentication. */
diff --git a/src/message.c b/src/message.c
index a3fe279..8fa34b5 100644
--- a/src/message.c
+++ b/src/message.c
@@ -361,8 +361,7 @@ static gcry_error_t go_encrypted(const OtrlAuthInfo *auth, void *asdata)
 	/* This is just a refresh of the existing session. */
 	if (edata->ops->still_secure) {
 	    edata->ops->still_secure(edata->opdata, edata->context,
-		    edata->context->auth.initiated,
-		    edata->context->auth.protocol_version);
+		    edata->context->auth.initiated);
 	}
 	edata->ignore_message = 1;
 	return gcry_error(GPG_ERR_NO_ERROR);
@@ -375,6 +374,8 @@ static gcry_error_t go_encrypted(const OtrlAuthInfo *auth, void *asdata)
 	edata->context->auth.secure_session_id_len;
     edata->context->sessionid_half =
 	edata->context->auth.session_id_half;
+    edata->context->protocol_version =
+	edata->context->auth.protocol_version;
 
     edata->context->their_keyid = edata->context->auth.their_keyid;
     gcry_mpi_release(edata->context->their_y);
@@ -412,8 +413,7 @@ static gcry_error_t go_encrypted(const OtrlAuthInfo *auth, void *asdata)
 	edata->ops->update_context_list(edata->opdata);
     }
     if (edata->ops->gone_secure) {
-	edata->ops->gone_secure(edata->opdata, edata->context,
-		edata->context->auth.protocol_version);
+	edata->ops->gone_secure(edata->opdata, edata->context);
     }
 
     edata->gone_encrypted = 1;
diff --git a/src/message.h b/src/message.h
index 986aa80..56c8d04 100644
--- a/src/message.h
+++ b/src/message.h
@@ -84,20 +84,15 @@ typedef struct s_OtrlMessageAppOps {
     /* The list of known fingerprints has changed.  Write them to disk. */
     void (*write_fingerprints)(void *opdata);
 
-    /* A ConnContext has entered a secure state.  protocol_version is
-     * the version of the OTR protocol used for the authentication. */
-    void (*gone_secure)(void *opdata, ConnContext *context,
-	    int protocol_version);
+    /* A ConnContext has entered a secure state. */
+    void (*gone_secure)(void *opdata, ConnContext *context);
 
     /* A ConnContext has left a secure state. */
     void (*gone_insecure)(void *opdata, ConnContext *context);
 
     /* We have completed an authentication, using the D-H keys we
-     * already knew.  is_reply indicates whether we initiated the AKE.
-     * protocol_version is the version of the OTR protocol used for the
-     * authentication. */
-    void (*still_secure)(void *opdata, ConnContext *context, int is_reply,
-	    int protocol_version);
+     * already knew.  is_reply indicates whether we initiated the AKE. */
+    void (*still_secure)(void *opdata, ConnContext *context, int is_reply);
 
     /* Log a message.  The passed message will end in "\n". */
     void (*log_message)(void *opdata, const char *message);
diff --git a/src/tests.c b/src/tests.c
index f3a51ad..19e162e 100644
--- a/src/tests.c
+++ b/src/tests.c
@@ -75,11 +75,10 @@ static int op_display_otr_message(void *opdata, const char *accountname,
     return -1;
 }
 
-static void op_gone_secure(void *opdata, ConnContext *context,
-	    int protocol_version)
+static void op_gone_secure(void *opdata, ConnContext *context)
 {
-    printf("SECURE (%d): %s / %s\n\n", protocol_version, context->accountname,
-	    context->username);
+    printf("SECURE (%d): %s / %s\n\n", context->protocol_version,
+	    context->accountname, context->username);
 }
 
 static void op_gone_insecure(void *opdata, ConnContext *context)
@@ -87,10 +86,9 @@ static void op_gone_insecure(void *opdata, ConnContext *context)
     printf("INSECURE: %s / %s\n\n", context->accountname, context->username);
 }
 
-static void op_still_secure(void *opdata, ConnContext *context, int is_reply,
-	    int protocol_version)
+static void op_still_secure(void *opdata, ConnContext *context, int is_reply)
 {
-    printf("REFRESH (%d/%d): %s / %s\n\n", is_reply, protocol_version,
+    printf("REFRESH (%d/%d): %s / %s\n\n", is_reply, context->protocol_version,
 	    context->accountname, context->username);
 }
 

-- 
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