summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2008-02-05 14:35:42 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2008-02-05 14:35:42 +0000
commit1baff08ad8255b254149d456c632c853d3dc5c81 (patch)
tree1b2017c17e804f2216034af06da7510b4be8208a
parent2844a3ed59ed709738054e2081b402cd22a29a00 (diff)
BUILD : 1.7.21 (1373) BUGS : 855 NOTES : Fixed various issues in handling of DefCon modes with params
git-svn-id: svn://svn.anope.org/anope/trunk@1373 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1088 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--Changes1
-rw-r--r--src/operserv.c27
-rw-r--r--version.log6
3 files changed, 29 insertions, 5 deletions
diff --git a/Changes b/Changes
index 43cc89e38..8e7b23885 100644
--- a/Changes
+++ b/Changes
@@ -26,6 +26,7 @@ Anope Version S V N
02/08 F Various small compiler warnings. [#685]
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]
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/operserv.c b/src/operserv.c
index 6c4faa64f..7514d0dcd 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -1668,7 +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 */
+
/* Reinitialize everything */
DefConModesOn = 0;
DefConModesOff = 0;
@@ -1676,9 +1678,12 @@ int defconParseModeString(const char *str)
DefConModesCI.mlock_key = NULL;
DefConModesCI.mlock_flood = NULL;
DefConModesCI.mlock_redirect = NULL;
+
+ /* Initialize strtok() internal buffer */
+ strtok(str_copy, " ");
/* Loop while there are modes to set */
- while ((mode = *str++)) {
+ while ((mode = *str++) && (mode != ' ')) {
switch (mode) {
case '+':
add = 1;
@@ -1694,26 +1699,40 @@ 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);
return 0;
} else if (add) {
DefConModesOn |= cbm->flag;
DefConModesOff &= ~cbm->flag;
if (cbm->cssetvalue)
- cbm->cssetvalue(&DefConModesCI, strtok(NULL, " "));
+ {
+ 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)
+ {
cbm->cssetvalue(&DefConModesCI, NULL);
+ }
}
}
} else {
alog("DefConChanModes unknown mode character '%c'", mode);
+ free(str_copy);
return 0;
}
} /* while (*param) */
-
+
+ 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 c2d8b0549..46ea087e3 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="1372"
+VERSION_BUILD="1373"
# $Log$
#
+# BUILD : 1.7.21 (1373)
+# BUGS : 855
+# NOTES : Fixed various issues in handling of DefCon modes with params
+#
# BUILD : 1.7.21 (1372)
# BUGS : 854
# NOTES : Removed bs_fantasy_unban from core modules.