New configuration option "OperServerMode".

This commit is contained in:
Alexander Barton 2005-03-15 16:56:16 +00:00
parent 5e929effca
commit 1d08d51e2e
7 changed files with 58 additions and 16 deletions

View File

@ -12,6 +12,10 @@
ngIRCd CVSHEAD
- New configuration option "OperServerMode" to enable a workaround needed
when running an network with ircd2 servers and "OperCanUseMode" enabled
to prevent the ircd2 daemon to drop mode changes of IRC operators.
Patch by Florian Westphal, <westphal@foo.fh-furtwangen.de>.
- Implemented support for "secret channels" (channel mode "s").
- New configuration option "Mask" for [Operator] sections to limit OPER
commands to ussers with a specific IRC mask. Patch from Florian Westphal.
@ -589,4 +593,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: ChangeLog,v 1.263 2005/03/02 16:35:10 alex Exp $
$Id: ChangeLog,v 1.264 2005/03/15 16:56:16 alex Exp $

6
NEWS
View File

@ -12,6 +12,10 @@
ngIRCd CVSHEAD
- New configuration option "OperServerMode" to enable a workaround needed
when running an network with ircd2 servers and "OperCanUseMode" enabled
to prevent the ircd2 daemon to drop mode changes of IRC operators.
Patch by Florian Westphal, <westphal@foo.fh-furtwangen.de>.
- Implemented support for "secret channels" (channel mode "s").
- New configuration option "Mask" for [Operator] sections to limit OPER
commands to ussers with a specific IRC mask. Patch from Florian Westphal.
@ -201,4 +205,4 @@ ngIRCd 0.0.1, 31.12.2001
--
$Id: NEWS,v 1.70 2005/03/02 16:35:10 alex Exp $
$Id: NEWS,v 1.71 2005/03/15 16:56:16 alex Exp $

View File

@ -1,4 +1,4 @@
# $Id: sample-ngircd.conf,v 1.31 2005/03/02 16:07:30 alex Exp $
# $Id: sample-ngircd.conf,v 1.32 2005/03/15 16:56:16 alex Exp $
#
# This is a sample configuration file for the ngIRCd, which must be adepted
@ -89,6 +89,10 @@
# they are not(!) channel-operators?
;OperCanUseMode = no
# Mask IRC Operator mode requests as if they were coming from the server?
# (This is a compatibility hack for ircd-irc2 servers )
;OperServerMode = no
# Maximum number of simultaneous connection the server is allowed
# to accept (<=0: unlimited):
;MaxConnections = -1

View File

@ -1,5 +1,5 @@
.\"
.\" $Id: ngircd.conf.5,v 1.15 2005/03/02 16:07:31 alex Exp $
.\" $Id: ngircd.conf.5,v 1.16 2005/03/15 16:56:17 alex Exp $
.\"
.TH ngircd.conf 5 "February 2005" ngircd "ngIRCd Manual"
.SH NAME
@ -137,6 +137,11 @@ The server tries every <ConnectRetry> seconds to establish a link to not yet
Should IRC Operators be allowed to use the MODE command even if they are
not(!) channel-operators? Default: no.
.TP
\fBOperServerMode\fR
If OperCanUseMode is enabled, this may lead the compatibility problems with
Servers that run the ircd-irc2 Software. This Option "masks" mode requests
by non-chanops as if they were coming from the server. Default: no.
.TP
\fBMaxConnections\fR
Maximum number of simultaneous connection the server is allowed to accept
(<=0: unlimited). Default: -1.

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: conf.c,v 1.69 2005/03/02 16:07:31 alex Exp $";
static char UNUSED id[] = "$Id: conf.c,v 1.70 2005/03/15 16:56:18 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -142,6 +142,7 @@ Conf_Test( VOID )
printf( " PongTimeout = %d\n", Conf_PongTimeout );
printf( " ConnectRetry = %d\n", Conf_ConnectRetry );
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" );
printf( " OperServerMode = %s\n", Conf_OperServerMode == TRUE ? "yes" : "no" );
if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections );
else printf( " MaxConnections = -1\n" );
if( Conf_MaxConnectionsIP > 0 ) printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP );
@ -374,6 +375,7 @@ Set_Defaults( BOOLEAN InitServers )
Conf_Channel_Count = 0;
Conf_OperCanMode = FALSE;
Conf_OperServerMode = FALSE;
Conf_MaxConnections = -1;
Conf_MaxConnectionsIP = 5;
@ -561,6 +563,17 @@ Read_Config( VOID )
} /* Read_Config */
LOCAL BOOLEAN
Check_ArgIsTrue( const char *Arg )
{
if( strcasecmp( Arg, "yes" ) == 0 ) return TRUE;
if( strcasecmp( Arg, "true" ) == 0 ) return TRUE;
if( atoi( Arg ) != 0 ) return TRUE;
return FALSE;
} /* Check_ArgIsTrue */
LOCAL VOID
Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
{
@ -734,10 +747,13 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
if( strcasecmp( Var, "OperCanUseMode" ) == 0 )
{
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
if( strcasecmp( Arg, "yes" ) == 0 ) Conf_OperCanMode = TRUE;
else if( strcasecmp( Arg, "true" ) == 0 ) Conf_OperCanMode = TRUE;
else if( atoi( Arg ) != 0 ) Conf_OperCanMode = TRUE;
else Conf_OperCanMode = FALSE;
Conf_OperCanMode = Check_ArgIsTrue( Arg );
return;
}
if( strcasecmp( Var, "OperServerMode" ) == 0 )
{
/* Mask IRC operator as if coming from the server? (ircd-irc2 compat hack) */
Conf_OperServerMode = Check_ArgIsTrue( Arg );
return;
}
if( strcasecmp( Var, "MaxConnections" ) == 0 )

View File

@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
* $Id: conf.h,v 1.31 2005/03/02 16:07:31 alex Exp $
* $Id: conf.h,v 1.32 2005/03/15 16:56:18 alex Exp $
*
* Configuration management (header)
*/
@ -114,6 +114,11 @@ GLOBAL INT Conf_Channel_Count;
/* Are IRC operators allowed to always use MODE? */
GLOBAL BOOLEAN Conf_OperCanMode;
/* If an IRC op gives chanop privileges without being a chanop,
* ircd2 will ignore the command. This enables a workaround:
* It masks the command as coming from the server */
GLOBAL BOOLEAN Conf_OperServerMode;
/* Maximum number of connections to this server */
GLOBAL LONG Conf_MaxConnections;

View File

@ -14,7 +14,7 @@
#include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.38 2005/03/05 11:44:01 alex Exp $";
static char UNUSED id[] = "$Id: irc-mode.c,v 1.39 2005/03/15 16:56:18 alex Exp $";
#include "imp.h"
#include <assert.h>
@ -242,7 +242,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Handle channel and channel-user modes */
CHAR the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr;
BOOLEAN ok, set, modeok, skiponce;
BOOLEAN ok, set, modeok = FALSE, skiponce, use_servermode = FALSE;
INT mode_arg, arg_arg;
CLIENT *client;
LONG l;
@ -286,11 +286,13 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Is he channel operator? */
if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
else modeok = FALSE;
if( Conf_OperCanMode )
else if( Conf_OperCanMode )
{
/* auch IRC-Operatoren duerfen MODE verwenden */
if( Client_OperByMe( Origin )) modeok = TRUE;
/* IRC-Operators can use MODE as well */
if( Client_OperByMe( Origin )) {
modeok = TRUE;
if ( Conf_OperServerMode ) use_servermode = TRUE; /* Change Origin to Server */
}
}
}
else modeok = TRUE;
@ -584,6 +586,8 @@ chan_exit:
}
else
{
if ( use_servermode ) Origin = Client_ThisServer();
/* Send reply to client and inform other servers and channel users */
ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );
IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args );