From d25f6fcbe8e291dd858bf734fa85cde176dc8415 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Mon, 26 Dec 2005 15:02:47 +0100 Subject: Added OperPassword and RunMode = ForkDaemon settings. Oper stuff is *INSECURE* because users can just do /mode +o to become operator. --- irc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'irc.c') diff --git a/irc.c b/irc.c index 19b14668..f9dfea8a 100644 --- a/irc.c +++ b/irc.c @@ -263,7 +263,7 @@ void irc_free(irc_t * irc) } g_free(irc); - if( global.conf->runmode == RUNMODE_INETD ) + if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON ) g_main_quit( global.loop ); } @@ -421,7 +421,7 @@ int irc_exec( irc_t *irc, char **cmd ) { irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); } - else if( strcmp( cmd[1], (global.conf)->password ) == 0 ) + else if( strcmp( cmd[1], (global.conf)->auth_pass ) == 0 ) { irc->status = USTATUS_AUTHORIZED; } @@ -500,6 +500,15 @@ int irc_exec( irc_t *irc, char **cmd ) { irc_write( irc, ":%s PONG %s :%s", irc->myhost, irc->myhost, cmd[1]?cmd[1]:irc->myhost ); } + else if( g_strcasecmp( cmd[0], "OPER" ) == 0 ) + { + if( !cmd[2] ) + irc_reply( irc, 461, "%s :Need more parameters", cmd[0] ); + else if( strcmp( cmd[2], global.conf->oper_pass ) == 0 ) + irc_umode_set( irc, irc->nick, "+o" ); + // else + /* FIXME/TODO: Find out which reply to send now. */ + } else if( g_strcasecmp( cmd[0], "MODE" ) == 0 ) { if( !cmd[1] ) -- cgit v1.2.3