[Pkg-privacy-commits] [irssi-plugin-otr] 42/267: Bug in /otr auth.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:26 UTC 2015


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

infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.

commit bc204f9ddbb98f27709ce1bf45450fc4f50c2cfc
Author: Uli Meis <a.sporto+bee at gmail.com>
Date:   Sat Jan 24 03:39:30 2009 +0100

    Bug in /otr auth.
---
 formats.txt |  1 +
 irssi_otr.c | 21 +++++++++++++--------
 otr_util.c  |  5 +++++
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/formats.txt b/formats.txt
index 19a19cf..c358a4f 100644
--- a/formats.txt
+++ b/formats.txt
@@ -63,6 +63,7 @@ auth_peer_wrong_smp3	%s sent a wrong authentication message (SMP3).
 auth_peer_wrong_smp4	%s sent a wrong authentication message (SMP4).
 auth_successful	Authentication successful!
 auth_failed	Authentication failed!
+auth_needenc	You need to establish an OTR session before you can authenticate.
 Commands
 cmd_otr	We're alive
 cmd_qnotfound	Failed: Can't get nick and server of current query window. (Or maybe you're doing this in the status window?)
diff --git a/irssi_otr.c b/irssi_otr.c
index 2ef0cef..a3aae4f 100644
--- a/irssi_otr.c
+++ b/irssi_otr.c
@@ -134,18 +134,23 @@ static void cmd_generic(const char *cmd, const char *args, WI_ITEM_REC *item)
 		} else
 			otr_noticest(TXT_CMD_QNOTFOUND);
 	} else if (strcmp(cmd,"auth")==0) {
-		if (!args) {
-			otr_notice(query->server,query->name,
-				   TXT_CMD_AUTH);
-		} else {
+		if (args) {
 			char *second = strchr(args,' ');
 			char *add = strchr(args,'@');
-			if (add&&second&&(add<second)) {
-				*(second+1) = '\0';
-				otr_auth(NULL,NULL,args,second);
+			if (add&&second&&(add<second)&&(*(second+1))) {
+				*second = '\0';
+				otr_auth(NULL,NULL,args,second+1);
 				*second = ' ';
-			} else
+			} else if (query) {
 				otr_auth(query->server,query->name,NULL,args);
+			} else {
+				otr_noticest(TXT_CMD_QNOTFOUND);
+			}
+		} else if (query) {
+			otr_notice(query->server,query->name, 
+				   TXT_CMD_AUTH);
+		} else {
+			otr_noticest(TXT_CMD_AUTH);
 		}
 	}
 }
diff --git a/otr_util.c b/otr_util.c
index f9e89b5..b804de4 100644
--- a/otr_util.c
+++ b/otr_util.c
@@ -472,6 +472,11 @@ void otr_auth(IRC_CTX *ircctx, char *nick, const char *peername, const char *sec
 		return;
 	}
 
+	if (co->msgstate!=OTRL_MSGSTATE_ENCRYPTED) {
+		otr_notice(ircctx,nick,TXT_AUTH_NEEDENC);
+		return;
+	}
+
 	coi = co->app_data;
 
 	/* Aborting an ongoing auth */

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



More information about the Pkg-privacy-commits mailing list