]> jfr.im git - irc/evilnet/x3.git/commitdiff
Moved defcon gline check out to check_new_user and added a shun check also for defcon
authorsirvulcan <redacted>
Mon, 31 Jul 2006 02:58:11 +0000 (02:58 +0000)
committersirvulcan <redacted>
Mon, 31 Jul 2006 02:58:11 +0000 (02:58 +0000)
ChangeLog
docs/DEFCON
src/opserv.c
src/opserv.h
src/proto-p10.c
x3.conf.example

index 38ff49b38d13dc3e9fa517e3a49356d5dab72f3d..fee923e786a68059f910d09dff7bb6f40817c6e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,19 @@
 /***********************************************************************
  X3 ChangeLog
 
+2006-07-31  Neil Spierling  <sirvulcan@gmail.com>
+
+       * x3.conf.example: Added SHUN setting for DEFCON.
+
+       * doc/DEFCON: Added SHUN setting for DEFCON.
+
+       * src/opserv.c: Moved the gline check to here. Also added a SHUN
+       check.
+
+       * src/opserv.h: Added SHUN setting for DEFCON.
+
+       * src/proto-p10.c: Moved the DEFCON gline check to opserv.c
+
 2006-07-31  Neil Spierling  <sirvulcan@gmail.com>
 
        * x3.conf.example: Added new Defcon system settings
index dfe55b901350220ece40e8ed1303d5b92cfebbd9..9eb1b67e877a4b917e87586b09eabee111906d1c 100644 (file)
@@ -50,6 +50,7 @@ X3 DefCon
     Services will silently ignore everyone but opers 128 
     GLINE all new clients trying to connect          256 
     No new memos sent to block MemoServ attacks      512
+    SHUN all new clients trying to connect          1024
 
     These are the values used to determine each defcon setting, are set via: 
 
index 77c945d8eaebba2cc7aa66ec00f5d1cb00bfb36b..e0a3c8e884b8b616308ab7de25a880e053543443 100644 (file)
@@ -390,6 +390,7 @@ static const struct message_entry msgtab[] = {
     { "OSMSG_DEFCON_OPER_ONLY", "Allowing Services Communication With Opers Only" },
     { "OSMSG_DEFCON_SILENT_OPER_ONLY", "Allowing Services Communication With Opers Only AND Silently Ignoring Regular Users" },
     { "OSMSG_DEFCON_GLINE_NEW_CLIENTS", "Glining New Clients" },
+    { "OSMSG_DEFCON_SHUN_NEW_CLIENTS", "Shunning New Clients" },
     { "OSMSG_DEFCON_NO_NEW_MEMOS", "Disallowing New Memos" },
 
     { NULL, NULL }
@@ -630,6 +631,9 @@ void showDefConSettings(struct userNode *user, struct svccmd *cmd)
     if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS))
         reply("OSMSG_DEFCON_GLINE_NEW_CLIENTS");
 
+    if (checkDefCon(DEFCON_SHUN_NEW_CLIENTS))
+        reply("OSMSG_DEFCON_SHUN_NEW_CLIENTS");
+
     if (checkDefCon(DEFCON_NO_NEW_MEMOS))
         reply("OSMSG_DEFCON_NO_NEW_MEMOS");
 
@@ -2392,6 +2396,18 @@ opserv_new_user_check(struct userNode *user)
         return 0;
     }
 
+    if ( (checkDefCon(DEFCON_GLINE_NEW_CLIENTS) || checkDefCon(DEFCON_SHUN_NEW_CLIENTS)) && !IsOper(user)) {
+        char target[IRC_NTOP_MAX_SIZE + 3] = { '*', '@', '\0' };
+
+        strcpy(target + 2, user->hostname);
+        if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS))
+            gline_add(opserv->nick, target, DefConGlineExpire, DefConGlineReason, now, 1, 0);
+        else if (checkDefCon(DEFCON_SHUN_NEW_CLIENTS))
+            shun_add(opserv->nick, target, DefConGlineExpire, DefConGlineReason, now, 1);
+          
+        return 0;
+    }
+
     /* Only warn or G-line if there's an untrusted max and their IP is sane. */
     if (opserv_conf.untrusted_max
         && irc_in_addr_is_valid(user->ip)
index d78db9c539d2a5c3190aa90b5c870dd13e89b568..3847f6230e70c6e4a8afce64a8e82267c77f8382 100644 (file)
@@ -23,7 +23,7 @@
 
 #define DEFCON_NO_NEW_CHANNELS          1       /* No New Channel Registrations */
 #define DEFCON_NO_NEW_NICKS             2       /* No New Nick Registrations */
-#define DEFCON_NO_MODE_CHANGE           4       /* No SET MODE changes */
+#define DEFCON_NO_MODE_CHANGE           4       /* No channel MODE changes */
 #define DEFCON_FORCE_CHAN_MODES         8       /* Force Chan Mode */
 #define DEFCON_REDUCE_SESSION           16      /* Reduce Session Limit */
 #define DEFCON_NO_NEW_CLIENTS           32      /* Kill any NEW clients */
 #define DEFCON_SILENT_OPER_ONLY         128     /* Silently ignore non-opers */
 #define DEFCON_GLINE_NEW_CLIENTS        256     /* Gline any new clients */
 #define DEFCON_NO_NEW_MEMOS             512     /* No New Memos Sent */
+#define DEFCON_SHUN_NEW_CLIENTS         1024    /* Shun any new clients */
 
 extern int DefCon[6];
 extern int checkDefCon(int level);
 extern void DefConProcess(struct userNode *user);
 extern void defcon_timeout(UNUSED_ARG(void *data));
+
 void init_opserv(const char *nick);
 unsigned int gag_create(const char *mask, const char *owner, const char *reason, time_t expires);
 int opserv_bad_channel(const char *name);
index 775679879ca79c7b98c1ba25e47f94c23ed39c8b..edf23c705be6e32dd517f89375994a32e7de5972 100644 (file)
@@ -320,10 +320,8 @@ static struct userNode *AddUser(struct server* uplink, const char *nick, const c
 
 extern int off_channel;
 extern int DefConLevel;
-extern int DefConGlineExpire;
 extern int DefConTimeOut;
 extern char *DefConChanModes;
-extern char *DefConGlineReason;
 
 static int parse_oplevel(char *str);
 
@@ -1319,17 +1317,6 @@ static CMD_FUNC(cmd_nick)
         else
             strcpy(modes, "+");
         nuser = AddUser(serv, argv[1], argv[4], argv[5], modes, argv[argc-2], argv[argc-1], atoi(argv[3]), argv[argc-3]);
-        if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS) && !IsOper(nuser)) {
-            char target[IRC_NTOP_MAX_SIZE + 3] = { '*', '@', '\0' };
-            const char *str;
-            
-            str = conf_get_data("services/opserv/nick", RECDB_QSTRING);
-            if (str) {
-                strcpy(target + 2, nuser->hostname);
-                gline_add(str, target, DefConGlineExpire, DefConGlineReason, now, 1, 0);
-            }
-            return 0;
-        }
     }
     return 1;
 }
index 77a3c9de3a11c2d0ae4835811a40a6c80e9883cd..fbba2896aeae2f7fd609eef6aa7d510e811faa26 100644 (file)
         // Services will silently ignore everyone but opers 128 
         // GLINE all new clients trying to connect          256 
         // No new memos sent to block MemoServ attacks      512
+        // SHUN all new clients trying to connect          1024
         // 
         // These are the values are added together to determine each defcon setting: 
         "DefCon1" "415"; 
         // If defcon is limiting sessions then how many sessions should O3 allow?
         "DefConSessionLimit" "2";
 
-        // Length of the gline set on newly connecting clients, if defcon is glining
-        // newly connecting clients
+        // Length of glines and shuns set on newly connecting clients, if defcon is glining 
+        // or shunning newly connecting clients
         "DefConGlineExpire" "5m";
 
         // Mode to set on all channels if defcon is forcing channel modes on all channels
         // This notice will be used if GlobalOnDefcon and GlobalOnDefconMore are off
         "DefConOffMessage" "Services are now back to normal, sorry for any inconvenience";
 
-        // Reason placed in defcon Glines.
+        // Reason placed in defcon Glines and Shuns.
         "DefConGlineReason" "This network is currently not accepting connections, please try again later";
 
         // ------------------------------------------------------------------