Bladeren bron

Fix OPs engaging the mass flood protection

Bryan Drewery 14 jaren geleden
bovenliggende
commit
8b8528cc6a
2 gewijzigde bestanden met toevoegingen van 20 en 15 verwijderingen
  1. 1 0
      doc/UPDATES
  2. 19 15
      src/mod/irc.mod/chan.c

+ 1 - 0
doc/UPDATES

@@ -4,6 +4,7 @@ maint
   * Don't allow running as root
   * Don't allow more than 5 bots per binary.
   * Fix CAPS/COLOR flood detection not obeying x|x flags
+  * Fix OPs engaging the mass flood protection
 
 1.4.0 - http://wraith.botpack.net/milestone/1.4.0
   * Updated server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.

+ 19 - 15
src/mod/irc.mod/chan.c

@@ -655,22 +655,26 @@ static bool detect_chan_flood(memberlist* m, const char *from, struct chanset_t
       return 0;
     }
 
-    bd::HashTable<flood_t, time_t>      *global_floodtime = &(*chan->channel.floodtime)["all"];
-    bd::HashTable<flood_t, int>         *global_floodnum = &(*chan->channel.floodnum)["all"];
+    // No point locking down due to OPs flooding.
+    if (!chan_hasop(m)) {
 
-    if ((*global_floodtime)[which] < now - mlapse) {
-      /* Flood timer expired, reset it */
-      (*global_floodtime)[which] = now;
-      (*global_floodnum)[which] = increment;
-    } else {
-      (*global_floodnum)[which] += increment;
-
-      if ((*global_floodnum)[which] >= mthr) {	/* FLOOD */
-        /* Reset counters */
-        (*global_floodnum).remove(which);
-        (*global_floodtime).remove(which);
-        if (!chan->channel.drone_set_mode) {
-          lockdown_chan(chan, FLOOD_MASS_FLOOD, ftype);
+      bd::HashTable<flood_t, time_t>      *global_floodtime = &(*chan->channel.floodtime)["all"];
+      bd::HashTable<flood_t, int>         *global_floodnum = &(*chan->channel.floodnum)["all"];
+
+      if ((*global_floodtime)[which] < now - mlapse) {
+        /* Flood timer expired, reset it */
+        (*global_floodtime)[which] = now;
+        (*global_floodnum)[which] = increment;
+      } else {
+        (*global_floodnum)[which] += increment;
+
+        if ((*global_floodnum)[which] >= mthr) {	/* FLOOD */
+          /* Reset counters */
+          (*global_floodnum).remove(which);
+          (*global_floodtime).remove(which);
+          if (!chan->channel.drone_set_mode) {
+            lockdown_chan(chan, FLOOD_MASS_FLOOD, ftype);
+          }
         }
       }
     }