summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPatrick Griffis <tingping@tingping.se>2016-03-24 14:44:28 -0400
committerPatrick Griffis <tingping@tingping.se>2016-03-24 15:42:49 -0400
commit47b357b2e14fc12840a29a9d455b9a95183453c0 (patch)
tree6f9fc93ae2b6cf7f5a9e7dfefa8e16328fb43e55
parentc1a94e287906bcb4087325ab66a6af8fef836e5b (diff)
Only intercept QuakeNet challengeauth when enabled
-rw-r--r--src/common/proto-irc.c12
-rw-r--r--src/common/servlist.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index a565dbb6..8e0d0ec1 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -1178,13 +1178,19 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
 				}
 
 #ifdef USE_OPENSSL
-				if (!strncmp (text, "CHALLENGE ", 10))		/* QuakeNet CHALLENGE upon our request */
+				/* QuakeNet CHALLENGE upon our request */
+				if (serv->loginmethod == LOGIN_CHALLENGEAUTH && !serv->p_cmp (word[1], CHALLENGEAUTH_FULLHOST)
+				    && !strncmp (text, "CHALLENGE ", 10) && *serv->password)
 				{
-					char *response = challengeauth_response (((ircnet *)serv->network)->user ? ((ircnet *)serv->network)->user : prefs.hex_irc_user_name, serv->password, word[5]);
+					char *response;
+					ircnet *net = serv->network;
+					char *user = net && net->user ? net->user : prefs.hex_irc_user_name;
+
+					response = challengeauth_response (user, serv->password, word[5]);
 
 					tcp_sendf (serv, "PRIVMSG %s :CHALLENGEAUTH %s %s %s\r\n",
 						CHALLENGEAUTH_NICK,
-						((ircnet *)serv->network)->user ? ((ircnet *)serv->network)->user : prefs.hex_irc_user_name,
+						user,
 						response,
 						CHALLENGEAUTH_ALGO);
 
diff --git a/src/common/servlist.h b/src/common/servlist.h
index a305aede..ec885fef 100644
--- a/src/common/servlist.h
+++ b/src/common/servlist.h
@@ -82,6 +82,7 @@ extern GSList *network_list;
 
 #define CHALLENGEAUTH_ALGO		"HMAC-SHA-256"
 #define CHALLENGEAUTH_NICK		"Q@CServe.quakenet.org"
+#define CHALLENGEAUTH_FULLHOST		"Q!TheQBot@CServe.quakenet.org"
 
 /* DEFAULT_CHARSET is already defined in wingdi.h */
 #define IRC_DEFAULT_CHARSET		"UTF-8 (Unicode)"