Bad_OperPass(): code cleanup.

This commit is contained in:
Alexander Barton 2008-04-13 17:30:04 +02:00
parent f78b0c61e9
commit 3bf0c6f3b9
1 changed files with 10 additions and 5 deletions

View File

@ -35,14 +35,19 @@
#include "irc-oper.h" #include "irc-oper.h"
/**
* Handle invalid received OPER command.
* Log OPER attempt and send error message to client.
*/
static bool static bool
Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg)
{ {
Log( LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", Client_Mask( Client ), Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s",
errtoken, errmsg); Client_Mask(Client), errtoken, errmsg);
IRC_SetPenalty(Client, 3); IRC_SetPenalty(Client, 3);
return IRC_WriteStrClient( Client, ERR_PASSWDMISMATCH_MSG, Client_ID( Client )); return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG,
} Client_ID(Client));
} /* Bad_OperPass */
GLOBAL bool GLOBAL bool
@ -63,7 +68,7 @@ IRC_OPER( CLIENT *Client, REQUEST *Req )
return Bad_OperPass(Client, Req->argv[0], "not configured"); return Bad_OperPass(Client, Req->argv[0], "not configured");
if( strcmp( Conf_Oper[i].pwd, Req->argv[1] ) != 0 ) if( strcmp( Conf_Oper[i].pwd, Req->argv[1] ) != 0 )
return Bad_OperPass(Client, Conf_Oper[i].name, "Bad password"); return Bad_OperPass(Client, Conf_Oper[i].name, "bad password");
if( Conf_Oper[i].mask && (! Match( Conf_Oper[i].mask, Client_Mask( Client ) ))) if( Conf_Oper[i].mask && (! Match( Conf_Oper[i].mask, Client_Mask( Client ) )))
return Bad_OperPass(Client, Conf_Oper[i].mask, "hostmask check failed" ); return Bad_OperPass(Client, Conf_Oper[i].mask, "hostmask check failed" );