summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--src/actions.c38
-rw-r--r--src/botserv.c70
-rw-r--r--src/chanserv.c29
-rw-r--r--src/core/cs_clear.c216
-rw-r--r--src/operserv.c43
-rw-r--r--version.log6
7 files changed, 309 insertions, 94 deletions
diff --git a/Changes b/Changes
index 8e7b23885..5e209b985 100644
--- a/Changes
+++ b/Changes
@@ -27,6 +27,7 @@ Anope Version S V N
02/08 F Updated docs/WIN32.txt. [#846]
02/08 F Removed bs_fantasy_unban from core modules. [#854]
02/08 F Defcon mode parsing breaking when fed with modes with parameters. [#855]
+02/08 F do_cmode() called without passing TS. [#820]
Provided by Jan Milants <jan_renee@msn.com> - 2008
01/16 F Server traversion with next_server() failed to list all servers. [#831]
diff --git a/src/actions.c b/src/actions.c
index 9d28c7311..d7c1ecda1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -131,7 +131,9 @@ void sqline(char *mask, char *reason)
void common_unban(ChannelInfo * ci, char *nick)
{
int count, i;
- char *av[3], **bans;
+ char *av[4], **bans;
+ int ac;
+ char buf[BUFSIZE];
User *u;
char *host = NULL;
int matchfound = 0;
@@ -158,16 +160,29 @@ void common_unban(ChannelInfo * ci, char *nick)
if (ircd->svsmode_unban) {
anope_cmd_unban(ci->name, nick);
} else {
- av[0] = ci->name;
- av[1] = sstrdup("-b");
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = ci->name;
+ av[1] = buf;
+ av[2] = sstrdup("-b");
+ ac = 4;
+ } else {
+ av[0] = ci->name;
+ av[1] = sstrdup("-b");
+ ac = 3;
+ }
count = ci->c->bancount;
bans = scalloc(sizeof(char *) * count, 1);
memcpy(bans, ci->c->bans, sizeof(char *) * count);
for (i = 0; i < count; i++) {
if (match_usermask(bans[i], u)) {
anope_cmd_mode(whosends(ci), ci->name, "-b %s", bans[i]);
- av[2] = bans[i];
- do_cmode(whosends(ci), 3, av);
+ if (ircdcap->tsmode)
+ av[3] = bans[i];
+ else
+ av[2] = bans[i];
+
+ do_cmode(whosends(ci), ac, av);
matchfound++;
}
if (host) {
@@ -182,15 +197,22 @@ void common_unban(ChannelInfo * ci, char *nick)
if (match_userip(bans[i], u, host)) {
anope_cmd_mode(whosends(ci), ci->name, "-b %s",
bans[i]);
- av[2] = bans[i];
- do_cmode(whosends(ci), 3, av);
+ if (ircdcap->tsmode)
+ av[3] = bans[i];
+ else
+ av[2] = bans[i];
+
+ do_cmode(whosends(ci), ac, av);
}
}
}
matchfound = 0;
}
free(bans);
- free(av[1]);
+ if (ircdcap->tsmode)
+ free(av[2]);
+ else
+ free(av[1]);
}
/* host_resolve() sstrdup us this info so we gotta free it */
if (host) {
diff --git a/src/botserv.c b/src/botserv.c
index cc2dadd89..46f5fe3ac 100644
--- a/src/botserv.c
+++ b/src/botserv.c
@@ -767,25 +767,50 @@ void bot_join(ChannelInfo * ci)
int count = ci->c->bancount;
if (count) {
char botmask[BUFSIZE];
+ char buf[BUFSIZE];
char **bans = scalloc(sizeof(char *) * count, 1);
- char *av[3];
+ char *av[4];
+ int ac;
memcpy(bans, ci->c->bans, sizeof(char *) * count);
snprintf(botmask, sizeof(botmask), "%s!%s@%s", ci->bi->nick,
ci->bi->user, ci->bi->host);
- av[0] = ci->c->name;
- av[1] = sstrdup("-b");
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = ci->c->name;
+ av[1] = buf;
+ av[2] = sstrdup("-b");
+ ac = 4;
+ } else {
+ av[0] = ci->c->name;
+ av[1] = sstrdup("-b");
+ ac = 3;
+ }
+
for (i = 0; i < count; i++) {
if (match_wild_nocase(ci->c->bans[i], botmask)) {
anope_cmd_mode(ci->bi->nick, ci->name, "-b %s",
bans[i]);
- av[2] = sstrdup(bans[i]);
- do_cmode(ci->bi->nick, 3, av);
- free(av[2]);
+ if (ircdcap->tsmode)
+ av[3] = sstrdup(bans[i]);
+ else
+ av[2] = sstrdup(bans[i]);
+
+ do_cmode(ci->bi->nick, ac, av);
+
+ if (ircdcap->tsmode)
+ free(av[3]);
+ else
+ free(av[2]);
}
}
- free(av[1]);
+
+ if (ircdcap->tsmode)
+ free(av[2]);
+ else
+ free(av[1]);
+
free(bans);
}
@@ -832,19 +857,36 @@ static void check_ban(ChannelInfo * ci, User * u, int ttbtype)
bd->ttb[ttbtype]++;
if (bd->ttb[ttbtype] == ci->ttb[ttbtype]) {
- char *av[3];
+ char *av[4];
+ int ac;
char mask[BUFSIZE];
+ char buf[BUFSIZE];
bd->ttb[ttbtype] = 0;
- av[0] = ci->name;
- av[1] = sstrdup("+b");
get_idealban(ci, u, mask, sizeof(mask));
- av[2] = mask;
- anope_cmd_mode(ci->bi->nick, av[0], "+b %s", av[2]);
- do_cmode(ci->bi->nick, 3, av);
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = ci->name;
+ av[1] = buf;
+ av[2] = sstrdup("+b");
+ av[3] = mask;
+ ac = 4;
+ } else {
+ av[0] = ci->name;
+ av[1] = sstrdup("+b");
+ av[2] = mask;
+ ac = 3;
+ }
+
+ anope_cmd_mode(ci->bi->nick, ci->name, "+b %s", mask);
+ do_cmode(ci->bi->nick, ac, av);
send_event(EVENT_BOT_BAN, 3, u->nick, ci->name, mask);
- free(av[1]);
+ if (ircdcap->tsmode)
+ free(av[2]);
+ else
+ free(av[1]);
}
}
diff --git a/src/chanserv.c b/src/chanserv.c
index 2797feadb..d2fcc4d60 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -1484,7 +1484,9 @@ int check_kick(User * user, char *chan, time_t chants)
AutoKick *akick;
int i;
NickCore *nc;
- char *av[3];
+ char *av[4];
+ int ac;
+ char buf[BUFSIZE];
char mask[BUFSIZE];
const char *reason;
Timeout *t;
@@ -1578,11 +1580,26 @@ int check_kick(User * user, char *chan, time_t chants)
}
if (c) {
- av[0] = chan;
- av[1] = sstrdup("+b");
- av[2] = mask;
- do_cmode(whosends(ci), 3, av);
- free(av[1]);
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = chan;
+ av[1] = buf;
+ av[2] = sstrdup("+b");
+ av[3] = mask;
+ ac = 4;
+ } else {
+ av[0] = chan;
+ av[1] = sstrdup("+b");
+ av[2] = mask;
+ ac = 3;
+ }
+
+ do_cmode(whosends(ci), ac, av);
+
+ if (ircdcap->tsmode)
+ free(av[2]);
+ else
+ free(av[1]);
}
anope_cmd_mode(whosends(ci), chan, "+b %s", mask);
diff --git a/src/core/cs_clear.c b/src/core/cs_clear.c
index db0f1d52f..16e5d6044 100644
--- a/src/core/cs_clear.c
+++ b/src/core/cs_clear.c
@@ -192,7 +192,9 @@ int do_clear(User * u)
notice_lang(s_ChanServ, u, CHAN_CLEARED_MODES, chan);
} else if (stricmp(what, "ops") == 0) {
- char *av[3];
+ char *av[4];
+ int ac;
+ char buf[BUFSIZE];
struct c_userlist *cu, *next;
if (ircd->svsmode_ucmode) {
@@ -213,20 +215,54 @@ int do_clear(User * u)
} else {
snprintf(tmp, BUFSIZE, "%so",
ircd->ownerunset);
- av[1] = sstrdup(tmp);
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup(tmp);
+ } else {
+ av[1] = sstrdup(tmp);
+ }
}
} else {
snprintf(tmp, BUFSIZE, "%so", ircd->adminunset);
- av[1] = sstrdup(tmp);
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup(tmp);
+ } else {
+ av[1] = sstrdup(tmp);
+ }
}
} else {
- av[1] = sstrdup("-o");
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup("-o");
+ } else {
+ av[1] = sstrdup("-o");
+ }
+ }
+
+ if (ircdcap->tsmode) {
+ av[3] = sstrdup(cu->user->nick);
+ ac = 4;
+ } else {
+ av[2] = sstrdup(cu->user->nick);
+ ac = 3;
+ }
+
+ do_cmode(s_ChanServ, ac, av);
+
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ } else {
+ free(av[2]);
+ free(av[1]);
}
- av[2] = sstrdup(cu->user->nick);
- do_cmode(s_ChanServ, 3, av);
- free(av[2]);
- free(av[1]);
}
free(av[0]);
} else {
@@ -240,73 +276,169 @@ int do_clear(User * u)
} else {
snprintf(tmp, BUFSIZE, "%so",
ircd->ownerunset);
- av[1] = sstrdup(tmp);
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup(tmp);
+ } else {
+ av[1] = sstrdup(tmp);
+ }
}
} else {
snprintf(tmp, BUFSIZE, "%so", ircd->adminunset);
- av[1] = sstrdup(tmp);
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup(tmp);
+ } else {
+ av[1] = sstrdup(tmp);
+ }
}
} else {
- av[1] = sstrdup("-o");
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[1] = buf;
+ av[2] = sstrdup("-o");
+ } else {
+ av[1] = sstrdup("-o");
+ }
+ }
+
+ if (ircdcap->tsmode) {
+ av[3] = sstrdup(cu->user->nick);
+ ac = 4;
+
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[2],
+ av[3]);
+ } else {
+ av[2] = sstrdup(cu->user->nick);
+ ac = 3;
+
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ }
+
+ do_cmode(s_ChanServ, ac, av);
+
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ free(av[0]);
+ } else {
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
}
- av[2] = sstrdup(cu->user->nick);
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
- av[2]);
- do_cmode(s_ChanServ, 3, av);
- free(av[2]);
- free(av[1]);
- free(av[0]);
}
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_OPS, chan);
} else if (ircd->halfop && stricmp(what, "hops") == 0) {
- char *av[3];
+ char *av[4];
+ int ac;
+ char buf[BUFSIZE];
struct c_userlist *cu, *next;
for (cu = c->users; cu; cu = next) {
next = cu->next;
if (!chan_has_user_status(c, cu->user, CUS_HALFOP))
continue;
- av[0] = sstrdup(chan);
- av[1] = sstrdup("-h");
- av[2] = sstrdup(cu->user->nick);
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = sstrdup(chan);
+ av[1] = buf;
+ av[2] = sstrdup("-h");
+ av[3] = sstrdup(cu->user->nick);
+ ac = 4;
+ } else {
+ av[0] = sstrdup(chan);
+ av[1] = sstrdup("-h");
+ av[2] = sstrdup(cu->user->nick);
+ ac = 3;
+ }
+
if (ircd->svsmode_ucmode) {
- anope_cmd_svsmode_chan(av[0], av[1], NULL);
- do_cmode(s_ChanServ, 3, av);
+ if (ircdcap->tsmode)
+ anope_cmd_svsmode_chan(av[0], av[2], NULL);
+ else
+ anope_cmd_svsmode_chan(av[0], av[1], NULL);
+
+ do_cmode(s_ChanServ, ac, av);
break;
} else {
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
- av[2]);
+ if (ircdcap->tsmode)
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[2],
+ av[3]);
+ else
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ }
+ do_cmode(s_ChanServ, ac, av);
+
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ free(av[0]);
+ } else {
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
}
- do_cmode(s_ChanServ, 3, av);
- free(av[2]);
- free(av[1]);
- free(av[0]);
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_HOPS, chan);
} else if (stricmp(what, "voices") == 0) {
- char *av[3];
+ char *av[4];
+ int ac;
+ char buf[BUFSIZE];
struct c_userlist *cu, *next;
for (cu = c->users; cu; cu = next) {
next = cu->next;
if (!chan_has_user_status(c, cu->user, CUS_VOICE))
continue;
- av[0] = sstrdup(chan);
- av[1] = sstrdup("-v");
- av[2] = sstrdup(cu->user->nick);
+
+ if (ircdcap->tsmode) {
+ snprintf(buf, BUFSIZE - 1, "%ld", (long int) time(NULL));
+ av[0] = sstrdup(chan);
+ av[1] = buf;
+ av[2] = sstrdup("-v");
+ av[3] = sstrdup(cu->user->nick);
+ ac = 4;
+ } else {
+ av[0] = sstrdup(chan);
+ av[1] = sstrdup("-v");
+ av[2] = sstrdup(cu->user->nick);
+ ac = 3;
+ }
+
if (ircd->svsmode_ucmode) {
- anope_cmd_svsmode_chan(av[0], av[1], NULL);
- do_cmode(s_ChanServ, 3, av);
+ if (ircdcap->tsmode)
+ anope_cmd_svsmode_chan(av[0], av[2], NULL);
+ else
+ anope_cmd_svsmode_chan(av[0], av[1], NULL);
+
+ do_cmode(s_ChanServ, ac, av);
break;
} else {
- anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
- av[2]);
+ if (ircdcap->tsmode) {
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[2],
+ av[3]);
+ } else {
+ anope_cmd_mode(whosends(ci), av[0], "%s :%s", av[1],
+ av[2]);
+ }
+ }
+ do_cmode(s_ChanServ, ac, av);
+
+ if (ircdcap->tsmode) {
+ free(av[3]);
+ free(av[2]);
+ free(av[0]);
+ } else {
+ free(av[2]);
+ free(av[1]);
+ free(av[0]);
}
- do_cmode(s_ChanServ, 3, av);
- free(av[2]);
- free(av[1]);
- free(av[0]);
}
notice_lang(s_ChanServ, u, CHAN_CLEARED_VOICES, chan);
} else if (stricmp(what, "users") == 0) {
diff --git a/src/operserv.c b/src/operserv.c
index 7514d0dcd..b0f1925d2 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -1668,9 +1668,9 @@ int defconParseModeString(const char *str)
int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */
unsigned char mode;
CBMode *cbm;
- char *str_copy = sstrdup(str); /* We need this copy as str is const -GD */
- char *param; /* Store parameters during mode parsing */
-
+ char *str_copy = sstrdup(str); /* We need this copy as str is const -GD */
+ char *param; /* Store parameters during mode parsing */
+
/* Reinitialize everything */
DefConModesOn = 0;
DefConModesOff = 0;
@@ -1678,9 +1678,9 @@ int defconParseModeString(const char *str)
DefConModesCI.mlock_key = NULL;
DefConModesCI.mlock_flood = NULL;
DefConModesCI.mlock_redirect = NULL;
-
- /* Initialize strtok() internal buffer */
- strtok(str_copy, " ");
+
+ /* Initialize strtok() internal buffer */
+ strtok(str_copy, " ");
/* Loop while there are modes to set */
while ((mode = *str++) && (mode != ' ')) {
@@ -1699,40 +1699,37 @@ int defconParseModeString(const char *str)
if ((int) mode < 128 && (cbm = &cbmodes[(int) mode])->flag != 0) {
if (cbm->flags & CBM_NO_MLOCK) {
alog("DefConChanModes mode character '%c' cannot be locked", mode);
- free(str_copy);
+ free(str_copy);
return 0;
} else if (add) {
DefConModesOn |= cbm->flag;
DefConModesOff &= ~cbm->flag;
- if (cbm->cssetvalue)
- {
- if (!(param = strtok(NULL, " ")))
- {
- alog("DefConChanModes mode character '%c' has no parameter while one is expected", mode);
- free(str_copy);
- return 0;
- }
+ if (cbm->cssetvalue) {
+ if (!(param = strtok(NULL, " "))) {
+ alog("DefConChanModes mode character '%c' has no parameter while one is expected", mode);
+ free(str_copy);
+ return 0;
+ }
cbm->cssetvalue(&DefConModesCI, param);
- }
+ }
} else {
DefConModesOff |= cbm->flag;
if (DefConModesOn & cbm->flag) {
DefConModesOn &= ~cbm->flag;
- if (cbm->cssetvalue)
- {
+ if (cbm->cssetvalue) {
cbm->cssetvalue(&DefConModesCI, NULL);
- }
+ }
}
}
} else {
alog("DefConChanModes unknown mode character '%c'", mode);
- free(str_copy);
+ free(str_copy);
return 0;
}
} /* while (*param) */
-
- free(str_copy);
-
+
+ free(str_copy);
+
if (ircd->Lmode) {
/* We can't mlock +L if +l is not mlocked as well. */
if ((DefConModesOn & ircd->chan_lmode)
diff --git a/version.log b/version.log
index 46ea087e3..bd6fc704d 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="21"
VERSION_EXTRA="-svn"
-VERSION_BUILD="1373"
+VERSION_BUILD="1374"
# $Log$
#
+# BUILD : 1.7.21 (1374)
+# BUGS : 820
+# NOTES : do_cmode() called without passing TS
+#
# BUILD : 1.7.21 (1373)
# BUGS : 855
# NOTES : Fixed various issues in handling of DefCon modes with params