diff --git a/Changes b/Changes index db89a57be..50ff7eb1f 100644 --- a/Changes +++ b/Changes @@ -1657,3 +1657,7 @@ seen. gmtime warning still there - Converted _conf_alias to conf3, in the process changed the format to be slightly more stable. See aliases/aliases.conf for the format changes - Numerous Sts-coded-conf3-while-sick bugs +- Added SVSLUSERS, allows changing of local/global max users. This is designed so services + can make sure all servers report the same global max and that a local max can be adjusted + if for example a clone flood occurs. It is NOT designed to make the max count higher than + you actually have. diff --git a/makefile.win32 b/makefile.win32 index fbcb448a0..d35041573 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -47,7 +47,8 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB SRC/M_SQLINE.OBJ SRC/M_KILL.OBJ SRC/M_TSCTL.OBJ SRC/M_UNKLINE.OBJ \ SRC/M_UNSQLINE.OBJ SRC/M_UNZLINE.OBJ SRC/M_WHOIS.OBJ SRC/M_ZLINE.OBJ \ SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/M_VHOST.OBJ \ - SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/INVISIBILITY.OBJ + SRC/M_CYCLE.OBJ SRC/M_SVSJOIN.OBJ SRC/M_SVSPART.OBJ SRC/M_SVSLUSERS.OBJ \ + SRC/INVISIBILITY.OBJ ALL: CONF UNREAL.EXE WIRCD.EXE @@ -365,6 +366,9 @@ src/m_svsjoin.obj: src/modules/m_svsjoin.c $(INCLUDES) src/m_svspart.obj: src/modules/m_svspart.c $(INCLUDES) $(CC) $(CFLAGS) src/modules/m_svspart.c +src/m_svslusers.obj: src/modules/m_svslusers.c $(INCLUDES) + $(CC) $(CFLAGS) src/modules/m_svslusers.c + src/scan.obj: src/modules/scan.c $(INCLUDES) $(CC) $(CFLAGS) src/modules/scan.c diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in index bdf633a5c..af32d19e4 100644 --- a/src/modules/Makefile.in +++ b/src/modules/Makefile.in @@ -43,7 +43,7 @@ COMMANDS=m_sethost.c m_chghost.c m_chgident.c m_setname.c m_setident.c \ m_quit.c m_rakill.c m_rping.c m_sendumode.c m_sqline.c \ m_tsctl.c m_unkline.c m_unsqline.c m_unzline.c m_whois.c \ m_tkl.c m_vhost.c m_cycle.c m_svsjoin.c m_svspart.c \ - m_zline.c m_kline.c + m_zline.c m_kline.c m_svslusers.c MODULES=commands.so $(R_MODULES) @@ -243,6 +243,10 @@ m_svspart.so: m_svspart.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o m_svspart.so m_svspart.c +m_svslusers.so: m_svslusers.c $(INCLUDES) + $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ + -o m_svslusers.so m_svslusers.c + scan.so: scan.c $(INCLUDES) $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \ -o scan.so scan.c diff --git a/src/modules/l_commands.c b/src/modules/l_commands.c index bae0d34d3..ed91fd5f4 100644 --- a/src/modules/l_commands.c +++ b/src/modules/l_commands.c @@ -87,7 +87,7 @@ extern int m_akill_Init(ModuleInfo *modinfo), m_rakill_Init(ModuleInfo *modinfo) extern int m_unzline_Init(ModuleInfo *modinfo), m_kline_Init(ModuleInfo *modinfo), m_unkline_Init(ModuleInfo *modinfo); extern int m_sqline_Init(ModuleInfo *modinfo), m_unsqline_Init(ModuleInfo *modinfo), m_tkl_Init(ModuleInfo *modinfo); extern int m_vhost_Init(ModuleInfo *modinfo), m_cycle_Init(ModuleInfo *modinfo), m_svsjoin_Init(ModuleInfo *modinfo); -extern int m_svspart_Init(ModuleInfo *modinfo); +extern int m_svspart_Init(ModuleInfo *modinfo), m_svslusers_Init(ModuleInfo *modinfo); #ifdef GUEST extern int m_guest_Init(ModuleInfo *modinfo); #endif @@ -112,7 +112,7 @@ extern int m_akill_Load(int module_load), m_rakill_Load(int module_load), m_zlin extern int m_unzline_Load(int module_load), m_kline_Load(int module_load), m_unkline_Load(int module_load); extern int m_sqline_Load(int module_load), m_unsqline_Load(int module_load), m_tkl_Load(int module_load); extern int m_vhost_Load(int module_load), m_cycle_Load(int module_load), m_svsjoin_Load(int module_load); -extern int m_svspart_Load(int module_load); +extern int m_svspart_Load(int module_load), m_svslusers_Load(int module_load); #ifdef GUEST extern int m_guest_Load(int module_load); #endif @@ -133,7 +133,7 @@ extern int m_message_Unload(), m_whois_Unload(), m_quit_Unload(), m_kill_Unload( extern int m_pingpong_Unload(), m_oper_Unload(), m_akill_Unload(), m_rakill_Unload(); extern int m_zline_Unload(), m_unzline_Unload(), m_kline_Unload(), m_unkline_Unload(); extern int m_sqline_Unload(), m_unsqline_Unload(), m_tkl_Unload(), m_vhost_Unload(); -extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload(); +extern int m_cycle_Unload(), m_svsjoin_Unload(), m_svspart_Unload(), m_svslusers_Unload(); #ifdef GUEST extern int m_guest_Unload(); #endif @@ -202,6 +202,7 @@ int l_commands_Init(ModuleInfo *modinfo) m_cycle_Init(&ModCmdsInfo); m_svsjoin_Init(&ModCmdsInfo); m_svspart_Init(&ModCmdsInfo); + m_svslusers_Init(&ModCmdsInfo); #ifdef GUEST m_guest_Init(&ModCmdsInfo); #endif @@ -268,6 +269,7 @@ int l_commands_Load(int module_load) m_cycle_Load(module_load); m_svsjoin_Load(module_load); m_svspart_Load(module_load); + m_svslusers_Load(module_load); #ifdef GUEST m_guest_Load(module_load); #endif @@ -330,6 +332,7 @@ int l_commands_Unload(int module_unload) m_cycle_Unload(); m_svsjoin_Unload(); m_svspart_Unload(); + m_svslusers_Unload(); #ifdef GUEST m_guest_Unload(); #endif diff --git a/src/modules/m_svslusers.c b/src/modules/m_svslusers.c new file mode 100644 index 000000000..446d4b1cf --- /dev/null +++ b/src/modules/m_svslusers.c @@ -0,0 +1,128 @@ +/* + * IRC - Internet Relay Chat, src/modules/m_svslusers.c + * (C) 2002 codemastr [Dominick Meglio] (codemastr@unrealircd.com) + * + * SVSLUSERS command, allows remote setting of local and global max user count + * + * See file AUTHORS in IRC package for additional names of + * the programmers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include "config.h" +#include "struct.h" +#include "common.h" +#include "sys.h" +#include "numeric.h" +#include "msg.h" +#include "channel.h" +#include +#include +#include +#include +#include +#ifdef _WIN32 +#include +#endif +#include +#include "h.h" +#include "proto.h" +#ifdef STRIPBADWORDS +#include "badwords.h" +#endif +#ifdef _WIN32 +#include "version.h" +#endif +extern ircstats IRCstats; +DLLFUNC int m_svslusers(aClient *cptr, aClient *sptr, int parc, char *parv[]); + +#define MSG_SVSLUSERS "SVSLUSERS" +#define TOK_SVSLUSERS "BU" + + +#ifndef DYNAMIC_LINKING +ModuleHeader m_svslusers_Header +#else +#define m_svslusers_Header Mod_Header +ModuleHeader Mod_Header +#endif + = { + "m_svslusers", + "$Id$", + "command /svslusers", + "3.2-b8-1", + NULL + }; + +#ifdef DYNAMIC_LINKING +DLLFUNC int Mod_Init(ModuleInfo *modinfo) +#else +int m_svslusers_Init(ModuleInfo *modinfo) +#endif +{ + add_Command(MSG_SVSLUSERS, TOK_SVSLUSERS, m_svslusers, MAXPARA); + return MOD_SUCCESS; +} + +#ifdef DYNAMIC_LINKING +DLLFUNC int Mod_Load(int module_load) +#else +int m_svslusers_Load(int module_load) +#endif +{ + return MOD_SUCCESS; +} + +#ifdef DYNAMIC_LINKING +DLLFUNC int Mod_Unload(int module_unload) +#else +int m_svslusers_Unload(int module_unload) +#endif +{ + if (del_Command(MSG_SVSLUSERS, TOK_SVSLUSERS, m_svslusers) < 0) + { + sendto_realops("Failed to delete commands when unloading %s", + m_svslusers_Header.name); + } + return MOD_SUCCESS; +} +/* +** m_svslusers +** parv[0] = sender +** parv[1] = server to update +** parv[2] = max global users +** parv[3] = max local users +** If -1 is specified for either number, it is ignored and the current count +** is kept. +*/ +int m_svslusers(aClient *cptr, aClient *sptr, int parc, char *parv[]) +{ + aClient *acptr; + + if (!IsULine(sptr) || parc < 4) + return -1; + if (hunt_server_token(cptr, sptr, MSG_SVSLUSERS, TOK_SVSLUSERS, "%s %s :%s", 1, parc, + parv) == HUNTED_ISME) + { + int temp; + temp = atoi(parv[2]); + if (temp >= 0) + IRCstats.global_max = temp; + temp = atoi(parv[3]); + if (temp >= 0) + IRCstats.me_max = temp; + } + return 0; +}