From 06f23669c64d9e2d3bdc190ab2973e63ec6e3f73 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 2 Jul 2008 09:48:22 +0000 Subject: [PATCH] Fix bug where you got disconnected if the server sent a 464 numeric (bad password) that the client wasn't expecting. The most common case is failing a CHALLENGE oper attempt. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@55 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 3 +++ source/numbers.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 4f24d64..9872caf 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,8 @@ [Changes 1.2c01 ] +* Fix bug where you got disconnected if the server sent a 464 numeric + (bad password) that the client wasn't expecting. (caf) + * Add /HOP and /DEHOP commands for halfop. (caf) * Removed "scan" plugin, this functionality is now covered by /SCAN -stat. diff --git a/source/numbers.c b/source/numbers.c index 7dd29d9..0464b83 100644 --- a/source/numbers.c +++ b/source/numbers.c @@ -1130,10 +1130,20 @@ void numbered_command(char *from, int comm, char **ArgList) case 464: /* #define ERR_PASSWDMISMATCH 464 */ { PasteArgs(ArgList, 0); + if (!is_server_open(from_server)) break; + flag = do_hook(current_numeric, "%s %s", from, ArgList[0]); - if (oper_command) + + /* If we get this numeric before registering, it means that + * our server password was wrong - so reprompt and reconnect. + * + * However if we're already registered, the server is trying to + * tell us something else (usually, OPER password wrong) so just + * pass it on to the user. + */ + if (is_server_connected(from_server)) { if (flag) display_msg(from, ArgList); @@ -1141,7 +1151,7 @@ void numbered_command(char *from, int comm, char **ArgList) } else { - char server_num[8]; + static char server_num[8]; say("Password required for connection to server %s", get_server_name(from_server));