summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h1
-rw-r--r--src/inspircd.cpp16
-rw-r--r--src/mode.cpp8
3 files changed, 25 insertions, 0 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 1a19584f6..0250f720e 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -156,6 +156,7 @@ void DoSplitEveryone();
char islast(const char* s);
long map_count(const char* s);
userrec* ReHashNick(char* Old, char* New);
+long GetMaxBans(char* name);
// mesh network functions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index af5200ef1..d979750b5 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1081,6 +1081,22 @@ chanrec* FindChan(const char* chan)
}
+long GetMaxBans(char* name)
+{
+ char CM[MAXBUF];
+ for (int count = 0; count < ConfValueEnum("banlist",&config_f); count++)
+ {
+ ConfValue("banlist","chan",count,CM,&config_f);
+ if (match(name,CM))
+ {
+ ConfValue("banlist","limit",count,CM,&config_f);
+ return atoi(CM);
+ }
+ }
+ return 64;
+}
+
+
void purge_empty_chans(void)
{
int go_again = 1, purge = 0;
diff --git a/src/mode.cpp b/src/mode.cpp
index 21817f283..12c6b2b92 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -464,6 +464,14 @@ char* add_ban(userrec *user,char *dest,chanrec *chan,int status)
c++;
if (c>1)
return NULL;
+
+ long maxbans = GetMaxBans(chan->name);
+ if (chan->bans.size() > maxbans)
+ {
+ WriteServ(user->fd,"478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)",user->nick, chan->name,chan->name,maxbans);
+ return NULL;
+ }
+
log(DEBUG,"add_ban: %s %s",chan->name,user->nick);
TidyBan(dest);