1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-13 10:20:28 +00:00

- Non-members of a channel could crash the server when trying to change its modes. Fixed.

This commit is contained in:
Alexander Barton 2003-01-17 19:04:19 +00:00
parent 155f26eee2
commit e07542a1ff

View File

@ -14,7 +14,7 @@
#include "portab.h" #include "portab.h"
static char UNUSED id[] = "$Id: irc-mode.c,v 1.29 2003/01/08 23:00:12 alex Exp $"; static char UNUSED id[] = "$Id: irc-mode.c,v 1.30 2003/01/17 19:04:19 alex Exp $";
#include "imp.h" #include "imp.h"
#include <assert.h> #include <assert.h>
@ -279,6 +279,10 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
/* Is the user allowed to change modes? */ /* Is the user allowed to change modes? */
if( Client_Type( Client ) == CLIENT_USER ) if( Client_Type( Client ) == CLIENT_USER )
{ {
/* Is the originating user on that channel? */
if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel ));
/* Is he channel operator? */
if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE; if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
else modeok = FALSE; else modeok = FALSE;
if( Conf_OperCanMode ) if( Conf_OperCanMode )