]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Implement user mode "F": "relaxed flood protection"
authorAlexander Barton <alex@barton.de>
Tue, 18 Mar 2014 13:55:38 +0000 (14:55 +0100)
committerAlexander Barton <alex@barton.de>
Tue, 18 Mar 2014 13:55:38 +0000 (14:55 +0100)
ngIRCd relaxes its flood protection for users having the user mode "F" set
and allows them to rapidly send data to the daemon. This mode is only
settable by IRC Operators and can cause problems in the network -- so be
careful and only set it on "trusted" clients!

User mode "F" is used by Bahamut for this purpose, for example, see
<http://docs.dal.net/docs/modes.html#4.9>.

doc/Modes.txt
src/ngircd/conn.c
src/ngircd/defines.h
src/ngircd/irc-mode.c

index aee7491c20783051d24d65705637c25ac3779cac..a9317873a92192454883ff23006a6e0fb01097c6 100644 (file)
@@ -2,7 +2,7 @@
                      ngIRCd - Next Generation IRC Server
                            http://ngircd.barton.de/
 
-               (c)2001-2012 Alexander Barton and Contributors.
+               (c)2001-2014 Alexander Barton and Contributors.
                ngIRCd is free software and published under the
                    terms of the GNU General Public License.
 
@@ -26,6 +26,7 @@ channels he is using at the moment.
   B    20      User is flagged as a "bot".
   c    17      IRC operator wants to receive connect/disconnect NOTICEs.
   C    19      Only users that share a channel are allowed to send messages.
+  F    22      Relaxed flood protection (only settable by IRC Operators).
   i    0.0.1   User is "invisible".
   o    0.0.1   User is IRC operator.
   q    20      User is protected, can not be kicked from a channel.
index 77c8cd8a04ae7c6dca8958663326b52a34053180..5c175dfd26e1bec492c2cb545296d6c37c58a55e 100644 (file)
@@ -1693,7 +1693,12 @@ Handle_Buffer(CONN_ID Idx)
                        maxcmd *= 5;
                break;
            case CLIENT_SERVICE:
-               maxcmd = MAX_COMMANDS_SERVICE; break;
+               maxcmd = MAX_COMMANDS_SERVICE;
+               break;
+           case CLIENT_USER:
+               if (Client_HasMode(c, 'F'))
+                       maxcmd = MAX_COMMANDS_SERVICE;
+               break;
        }
 
        for (i=0; i < maxcmd; i++) {
@@ -2427,6 +2432,10 @@ Throttle_Connection(const CONN_ID Idx, CLIENT *Client, const int Reason,
            || Client_Type(Client) == CLIENT_SERVICE)
                return;
 
+       /* Don't throttle clients with user mode 'F' set */
+       if (Client_HasMode(Client, 'F'))
+               return;
+
        LogDebug("Throttling connection %d: code %d, value %d!", Idx,
                 Reason, Value);
        Conn_SetPenalty(Idx, 1);
index 361564f00d239b297de3c87ce68e33fb05447ec6..4acdc477007febe97a8faa03133e4a2d15f98595 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #endif
 
 /** Supported user modes. */
-#define USERMODES "abBcCioqrRswx"
+#define USERMODES "abBcCFioqrRswx"
 
 /** Supported channel modes. */
 #define CHANMODES "abehiIklmMnoOPqQrRstvVz"
index 6a670079dd6fe7de05177e9ac8f668037920a4fe..fe981213b33c8d85a3ad3ccb467e54fd6b54b56d 100644 (file)
@@ -222,6 +222,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
                        break;
                case 'c': /* Receive connect notices */
                case 'q': /* KICK-protected user */
+               case 'F': /* disable flood protection */
                          /* (only settable by IRC operators!) */
                        if (!set || Client_Type(Client) == CLIENT_SERVER
                            || Client_HasMode(Origin, 'o'))