Only intercept QuakeNet challengeauth when enabled

This commit is contained in:
Patrick Griffis 2016-03-24 14:44:28 -04:00
parent c1a94e2879
commit 47b357b2e1
2 changed files with 10 additions and 3 deletions

View File

@ -1178,13 +1178,19 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
} }
#ifdef USE_OPENSSL #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", tcp_sendf (serv, "PRIVMSG %s :CHALLENGEAUTH %s %s %s\r\n",
CHALLENGEAUTH_NICK, CHALLENGEAUTH_NICK,
((ircnet *)serv->network)->user ? ((ircnet *)serv->network)->user : prefs.hex_irc_user_name, user,
response, response,
CHALLENGEAUTH_ALGO); CHALLENGEAUTH_ALGO);

View File

@ -82,6 +82,7 @@ extern GSList *network_list;
#define CHALLENGEAUTH_ALGO "HMAC-SHA-256" #define CHALLENGEAUTH_ALGO "HMAC-SHA-256"
#define CHALLENGEAUTH_NICK "Q@CServe.quakenet.org" #define CHALLENGEAUTH_NICK "Q@CServe.quakenet.org"
#define CHALLENGEAUTH_FULLHOST "Q!TheQBot@CServe.quakenet.org"
/* DEFAULT_CHARSET is already defined in wingdi.h */ /* DEFAULT_CHARSET is already defined in wingdi.h */
#define IRC_DEFAULT_CHARSET "UTF-8 (Unicode)" #define IRC_DEFAULT_CHARSET "UTF-8 (Unicode)"