diff -uNr ircservices-5.0.10/Changes ircservices-5.0.11/Changes --- ircservices-5.0.10/Changes 2003-02-19 11:08:45.000000000 +0900 +++ ircservices-5.0.11/Changes 2003-02-20 09:27:45.000000000 +0900 @@ -1,5 +1,9 @@ Version 5.0 ----------- +2003/02/20 .11 Fixed 2002/10/24 compilation problem fix (modules/Makefile + was missing the fix). +2003/02/20 Fixed bugs in the trircd protocol module. Reported by + Yusuf Iskenderoglu 2003/02/19 .10 Fixed bug causing Services to terminate with a fatal error on receiving multiple KILL messages in quick succession. Reported by Andrew Kempe diff -uNr ircservices-5.0.10/modules/Makefile ircservices-5.0.11/modules/Makefile --- ircservices-5.0.10/modules/Makefile 2003-02-19 11:15:31.000000000 +0900 +++ ircservices-5.0.11/modules/Makefile 2003-02-20 09:30:52.000000000 +0900 @@ -34,7 +34,7 @@ done @echo '{0}};' >>modlist.c $(CC) -c modlist.c -o modlist.o - ar r modules.a modlist.o + ar -r modules.a modlist.o install: @set -e ; for i in $(SUBDIRS) ; do \ diff -uNr ircservices-5.0.10/modules/Makerules ircservices-5.0.11/modules/Makerules --- ircservices-5.0.10/modules/Makerules 2003-01-22 23:36:40.000000000 +0900 +++ ircservices-5.0.11/modules/Makerules 2003-02-20 09:26:14.000000000 +0900 @@ -48,7 +48,7 @@ all-dynamic: $(MODULES) all-static: $(MODULES:.so=.a) - ld -r -o $(DIRNAME).o `ar t .$(DIRNAME).a` + ld -r -o $(DIRNAME).o `ar -t .$(DIRNAME).a` ar -cr ../modules.a $(DIRNAME).o ifeq ($(MODULES),) diff -uNr ircservices-5.0.10/modules/protocol/trircd.c ircservices-5.0.11/modules/protocol/trircd.c --- ircservices-5.0.10/modules/protocol/trircd.c 2003-02-19 11:15:32.000000000 +0900 +++ ircservices-5.0.11/modules/protocol/trircd.c 2003-02-20 09:30:53.000000000 +0900 @@ -13,6 +13,7 @@ #include "conffile.h" #include "language.h" #include "messages.h" +#include "modules/chanserv/chanserv.h" #include "modules/operserv/operserv.h" #include "modules/nickserv/nickserv.h" @@ -27,6 +28,7 @@ static Module *module; static Module *module_operserv; +static Module *module_chanserv; static char *NetworkDomain = NULL; @@ -35,6 +37,21 @@ #define GET_PROTOCOL_VERSION() (current_protocol_version) #define SET_PROTOCOL_VERSION(v) (current_protocol_version = (v)) +/* + * We import `s_ChanServ' from the "chanserv/main" module; this variable + * holds a pointer to `s_ChanServ', obtained via get_module_symbol(). When + * the ChanServ module is not loaded, this holds a pointer to `ServerName' + * instead as a default value. + * + * Note that we use a #define here to substitute `*p_s_ChanServ' for + * `s_ChanServ', so subsequent code can simply use `s_ChanServ' as if it + * were declared normally. + */ + +static char **p_s_ChanServ = &ServerName; +#define s_ChanServ (*p_s_ChanServ) + + /*************************************************************************/ /***************** Local interface to external routines ******************/ /*************************************************************************/ @@ -294,10 +311,10 @@ static void m_svinfo(char *source, int ac, char **av) { /* -TimeMr14C - * Obviously we do need to send an initial PING, regardless of the reality that - * services may be configured to send pings if there is low traffic. - * Additionally, to comply with the TRIRCD Extensions, we do set the topic - * of the services logging channel. + * Obviously we do need to send an initial PING, regardless of the + * reality that services may be configured to send pings if there is + * low traffic. Additionally, to comply with the TRIRCD Extensions, we + * do set the topic of the services logging channel. */ send_cmd(NULL, "PING :%s", ServerName); @@ -648,6 +665,28 @@ /*************************************************************************/ +static int do_channel_mode(const char *source, Channel *channel, + int modechar, int add, char **av) +{ + int32 flag = mode_char_to_flag(modechar, MODE_CHANNEL); + + switch (modechar) { + case 'f': + free(channel->flood); + if (add) { + channel->mode |= flag; + channel->flood = sstrdup(av[0]); + } else { + channel->mode &= ~flag; + channel->flood = NULL; + } + return 1; + } + return 0; +} + +/*************************************************************************/ + /* We set +L for the user's language here--but only if they haven't already * set it themselves. */ @@ -688,6 +727,63 @@ /*************************************************************************/ +static int do_check_modes(Channel *c, ChannelInfo *ci, int add, int32 flag) +{ + if (add) { + switch (mode_flag_to_char(flag, MODE_CHANNEL)) { + case 'f': + if (!ci->mlock_flood) { + module_log("warning: removing +f from channel %s mode lock" + " (missing parameter)", ci->name); + ci->mlock_on &= ~mode_char_to_flag('f', MODE_CHANNEL); + } else { + if (!c->flood || irc_stricmp(ci->mlock_flood, c->flood) != 0) + set_cmode(s_ChanServ, c, "+f", ci->mlock_flood); + } + return 1; + } + } + return 0; +} + +/*************************************************************************/ + +static int do_set_mlock(User *u, ChannelInfo *ci, int mode, int add, char **av) +{ + if (!mode) + return 0; + + /* Single mode set/clear */ + if (add) { + switch (mode) { + case 'f': { + char *s, *t; + /* Legal format for flood mode is "[*]digits:digits" */ + s = av[0]; + if (*s == '*') + s++; + t = strchr(s, ':'); + if (t) { + t++; + if (s[strspn(s,"0123456789")] == ':' + && t[strspn(t,"0123456789")] == 0 + ) { + /* String is valid */ + ci->mlock_flood = sstrdup(av[0]); + break; + } + } + /* String is invalid */ + notice_lang(s_ChanServ, u, CHAN_SET_MLOCK_FLOOD_BAD, mode); + return 1; + } + } + } + return 0; +} + +/*************************************************************************/ + static int do_clear_ban(Channel *chan, int what, const void *param) { if (what == CLEAR_BANS && param != NULL) { @@ -834,7 +930,21 @@ } else if (strcmp(modname, "nickserv/main") == 0) { if (!add_callback(mod, "identified", do_nick_identified)) module_log("Unable to add NickServ identified callback"); + } else if (strcmp(modname, "chanserv/main") == 0) { + module_chanserv = mod; + p_s_ChanServ = get_module_symbol(mod, "s_ChanServ"); + if (!p_s_ChanServ) { + /* FIXME: make a generalized logging routine for this problem? */ + module_log("Unable to resolve symbol `s_ChanServ' in module" + " `chanserv/main'"); + p_s_ChanServ = &ServerName; + } + if (!add_callback(mod, "check_modes", do_check_modes)) + module_log("Unable to add ChanServ check_modes callback"); + if (!add_callback(mod, "SET MLOCK", do_set_mlock)) + module_log("Unable to add ChanServ SET MLOCK callback"); } + return 0; } @@ -871,6 +981,7 @@ if (!add_callback(NULL, "load module", do_load_module) || !add_callback(NULL, "unload module", do_unload_module) || !add_callback(NULL, "user create", do_user_create) + || !add_callback(NULL, "channel MODE", do_channel_mode) || !add_callback(NULL, "user servicestamp change", do_user_servicestamp_change) || !add_callback(NULL, "user MODE", do_user_mode) diff -uNr ircservices-5.0.10/modules/protocol/unreal.c ircservices-5.0.11/modules/protocol/unreal.c --- ircservices-5.0.10/modules/protocol/unreal.c 2003-02-19 11:15:32.000000000 +0900 +++ ircservices-5.0.11/modules/protocol/unreal.c 2003-02-20 09:30:53.000000000 +0900 @@ -1041,12 +1041,24 @@ if (add) { switch (mode_flag_to_char(flag, MODE_CHANNEL)) { case 'L': - if (!c->link || irc_stricmp(ci->mlock_link, c->link) != 0) - set_cmode(s_ChanServ, c, "+L", ci->mlock_link); + if (!ci->mlock_link) { + module_log("warning: removing +L from channel %s mode lock" + " (missing parameter)", ci->name); + ci->mlock_on &= ~mode_char_to_flag('L', MODE_CHANNEL); + } else { + if (!c->link || irc_stricmp(ci->mlock_link, c->link) != 0) + set_cmode(s_ChanServ, c, "+L", ci->mlock_link); + } return 1; case 'f': - if (!c->flood || irc_stricmp(ci->mlock_flood, c->flood) != 0) - set_cmode(s_ChanServ, c, "+f", ci->mlock_flood); + if (!ci->mlock_flood) { + module_log("warning: removing +f from channel %s mode lock" + " (missing parameter)", ci->name); + ci->mlock_on &= ~mode_char_to_flag('f', MODE_CHANNEL); + } else { + if (!c->flood || irc_stricmp(ci->mlock_flood, c->flood) != 0) + set_cmode(s_ChanServ, c, "+f", ci->mlock_flood); + } return 1; } } diff -uNr ircservices-5.0.10/version.sh ircservices-5.0.11/version.sh --- ircservices-5.0.10/version.sh 2003-02-19 11:11:36.000000000 +0900 +++ ircservices-5.0.11/version.sh 2003-02-20 09:27:50.000000000 +0900 @@ -3,7 +3,7 @@ # Build the version.c file which contains all the version related info and # needs to be updated on a per-build basis. -VERSION=5.0.10 +VERSION=5.0.11 # Increment Services build number if [ -f version.c ] ; then