summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-04-21 11:50:12 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2007-04-21 11:50:12 +0000
commit092d240f6baa3b4f831192b5e2d6b880b637ee09 (patch)
treef178b4de532b3e596e3b5c84ddef3dd8bd3e50ac /src/core
parentab0dc81bc28f0802dc80e6848d3f813baef28f2e (diff)
BUILD : 1.7.18 (1238) BUGS : 662 NOTES : Fixed array count not being decremented on ChanServ access lists (provided by Jan Milants)
git-svn-id: svn://svn.anope.org/anope/trunk@1238 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@957 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/core')
-rw-r--r--src/core/cs_access.c36
-rw-r--r--src/core/cs_xop.c36
2 files changed, 50 insertions, 22 deletions
diff --git a/src/core/cs_access.c b/src/core/cs_access.c
index 1669791f7..9c52a4b9e 100644
--- a/src/core/cs_access.c
+++ b/src/core/cs_access.c
@@ -233,21 +233,23 @@ int do_access(User * u)
}
}
+ /* All entries should be in use so we no longer need
+ * to go over the entire list..
for (i = 0; i < ci->accesscount; i++) {
if (!ci->access[i].in_use)
break;
}
- if (i == ci->accesscount) {
- if (i < CSAccessMax) {
- ci->accesscount++;
- ci->access =
- srealloc(ci->access,
- sizeof(ChanAccess) * ci->accesscount);
- } else {
- notice_lang(s_ChanServ, u, CHAN_ACCESS_REACHED_LIMIT,
- CSAccessMax);
- return MOD_CONT;
- }
+ */
+
+ if (i < CSAccessMax) {
+ ci->accesscount++;
+ ci->access =
+ srealloc(ci->access,
+ sizeof(ChanAccess) * ci->accesscount);
+ } else {
+ notice_lang(s_ChanServ, u, CHAN_ACCESS_REACHED_LIMIT,
+ CSAccessMax);
+ return MOD_CONT;
}
access = &ci->access[i];
@@ -346,6 +348,18 @@ int do_access(User * u)
}
}
}
+
+ /* After reordering only the entries at the end could still be empty.
+ * We ll free the places no longer in use... */
+ for (i = ci->accesscount - 1; i >= 0; i--) {
+ if (ci->access[i].in_use == 1)
+ break;
+
+ ci->accesscount--;
+ }
+ ci->access =
+ srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount);
+
/* We don't know the nick if someone used numbers, so we trigger the event without
* nick param. We just do this once, even if someone enters a range. -Certus */
if (na)
diff --git a/src/core/cs_xop.c b/src/core/cs_xop.c
index 09eca4ce4..83cae81fe 100644
--- a/src/core/cs_xop.c
+++ b/src/core/cs_xop.c
@@ -301,21 +301,22 @@ int do_xop(User * u, char *xname, int xlev, int *xmsgs)
}
if (!change) {
+ /* All entries should be in use so we no longer need
+ * to go over the entire list..
for (i = 0; i < ci->accesscount; i++)
if (!ci->access[i].in_use)
break;
+ */
- if (i == ci->accesscount) {
- if (i < CSAccessMax) {
- ci->accesscount++;
- ci->access =
- srealloc(ci->access,
- sizeof(ChanAccess) * ci->accesscount);
- } else {
- notice_lang(s_ChanServ, u, CHAN_XOP_REACHED_LIMIT,
- CSAccessMax);
- return MOD_CONT;
- }
+ if (i < CSAccessMax) {
+ ci->accesscount++;
+ ci->access =
+ srealloc(ci->access,
+ sizeof(ChanAccess) * ci->accesscount);
+ } else {
+ notice_lang(s_ChanServ, u, CHAN_XOP_REACHED_LIMIT,
+ CSAccessMax);
+ return MOD_CONT;
}
access = &ci->access[i];
@@ -431,6 +432,19 @@ int do_xop(User * u, char *xname, int xlev, int *xmsgs)
}
}
}
+
+ /* If the patch provided in bug #706 is applied, this should be placed
+ * before sending the events! */
+ /* After reordering only the entries at the end could still be empty.
+ * We ll free the places no longer in use... */
+ for (i = ci->accesscount - 1; i >= 0; i--) {
+ if (ci->access[i].in_use == 1)
+ break;
+
+ ci->accesscount--;
+ }
+ ci->access =
+ srealloc(ci->access,sizeof(ChanAccess) * ci->accesscount);
}
} else if (stricmp(cmd, "LIST") == 0) {
int sent_header = 0;