]> jfr.im git - irc/atheme/atheme.git/commitdiff
Don't send duplicate K-Lines for a user (if they induce more than 1)
authorAaron Jones <redacted>
Fri, 24 Apr 2015 05:42:04 +0000 (05:42 +0000)
committerAaron Jones <redacted>
Fri, 24 Apr 2015 05:42:04 +0000 (05:42 +0000)
include/users.h
modules/operserv/akill.c
modules/operserv/clearchan.c
modules/operserv/clones.c
modules/operserv/rakill.c
modules/operserv/rwatch.c
modules/proxyscan/dnsbl.c

index 12889420df0da2fda583c628087aeb80907f3eab..8b4d16c6cb8b179af8faa7c71538b9eda235b0c9 100644 (file)
@@ -55,6 +55,7 @@ struct user_
 #define UF_WASENFORCED 0x00002000 /* this user was FNCed once already */
 #define UF_DEAF        0x00004000 /* user does not receive channel msgs */
 #define UF_SERVICE     0x00008000 /* user is a service (e.g. +S on charybdis) */
+#define UF_KLINESENT   0x00010000 /* we've sent a kline for this user */
 
 #define CLIENT_NAME(user)      ((user)->uid != NULL ? (user)->uid : (user)->nick)
 
index 10709d4355fb96120143eef326057e8acf323453..bf697354e9fc0bb9c3c2b40a6589b88f1e944072 100644 (file)
@@ -85,7 +85,10 @@ static void os_akill_newuser(hook_user_nick_t *data)
                 * not send a KILL. -- jilles */
                char reason[BUFSIZE];
                snprintf(reason, sizeof(reason), "[#%lu] %s", k->number, k->reason);
-               kline_sts("*", k->user, k->host, k->duration ? k->expires - CURRTIME : 0, reason);
+               if (! (u->flags & UF_KLINESENT)) {
+                       kline_sts("*", k->user, k->host, k->duration ? k->expires - CURRTIME : 0, reason);
+                       u->flags |= UF_KLINESENT;
+               }
        }
 }
 
index a1ca380eeb913002075c13d654d51c06e7381db5..e36574445dcf7d28165600e9fe9fb70382793624 100644 (file)
@@ -116,11 +116,15 @@ static void os_cmd_clearchan(sourceinfo_t *si, int parc, char *parv[])
                                        kill_user(si->service->me, cu->user, "%s", reason);
                                        break;
                                case CLEAR_AKILL:
-                                       if (is_autokline_exempt(cu->user))
+                                       if (is_autokline_exempt(cu->user)) {
                                                command_success_nodata(si, _("\2CLEARCHAN\2: Not klining exempt user %s!%s@%s"),
                                                                cu->user->nick, cu->user->user, cu->user->host);
-                                       else
-                                               kline_sts("*", "*", cu->user->host, 604800, reason);
+                                       } else {
+                                               if (! (cu->user->flags & UF_KLINESENT)) {
+                                                       kline_sts("*", "*", cu->user->host, 604800, reason);
+                                                       cu->user->flags |= UF_KLINESENT;
+                                               }
+                                       }
                        }
                }
        }
index be59265a3ad638b7ab04812c8bfff999746fae68..6ad7cf745cf1b893c954c9309e6927c8dc536446 100644 (file)
@@ -927,8 +927,11 @@ static void clones_newuser(hook_user_nick_t *data)
                }
                else
                {
-                       slog(LG_INFO, "CLONES: \2%d\2 clones on \2%s\2 (%s!%s@%s) (TKLINE due to excess clones)", i, u->ip, u->nick, u->user, u->host);
-                       kline_sts("*", "*", u->ip, kline_duration, "Excessive clones");
+                       if (! (u->flags & UF_KLINESENT)) {
+                               slog(LG_INFO, "CLONES: \2%d\2 clones on \2%s\2 (%s!%s@%s) (TKLINE due to excess clones)", i, u->ip, u->nick, u->user, u->host);
+                               kline_sts("*", "*", u->ip, kline_duration, "Excessive clones");
+                               u->flags |= UF_KLINESENT;
+                       }
                }
 
        }
index 2a9125ff796438fa6c28fd3d8270c2a395acfcbc..1c172aa48bff4efc486a639d612f48bea7b003aa 100644 (file)
@@ -110,7 +110,10 @@ static void os_cmd_rakill(sourceinfo_t *si, int parc, char *parv[])
                {
                        /* match */
                        command_success_nodata(si, _("\2Match:\2  %s!%s@%s %s - akilling"), u->nick, u->user, u->host, u->gecos);
-                       kline_sts("*", "*", u->host, 604800, reason);
+                       if (! (u->flags & UF_KLINESENT)) {
+                               kline_sts("*", "*", u->host, 604800, reason);
+                               u->flags |= UF_KLINESENT;
+                       }
                        matches++;
                }
        }
index 9ab63054e4ac6b1da2bc48c5e1c8b146fdcf8487..2522f8e868e58ea36626944c6e3c191a2c69820f 100644 (file)
@@ -553,7 +553,10 @@ static void rwatch_newuser(hook_user_nick_t *data)
                                        slog(LG_VERBOSE, "rwatch_newuser(): klining *@%s (user %s!%s@%s matches %s %s)",
                                                        u->host, u->nick, u->user, u->host,
                                                        rw->regex, rw->reason);
-                                       kline_sts("*", "*", u->host, 86400, rw->reason);
+                                       if (! (u->flags & UF_KLINESENT)) {
+                                               kline_sts("*", "*", u->host, 86400, rw->reason);
+                                               u->flags |= UF_KLINESENT;
+                                       }
                                }
                        }
                        else if (rw->actions & RWACT_QUARANTINE)
@@ -619,7 +622,10 @@ static void rwatch_nickchange(hook_user_nick_t *data)
                                        slog(LG_VERBOSE, "rwatch_nickchange(): klining *@%s (user %s -> %s!%s@%s matches %s %s)",
                                                        u->host, data->oldnick, u->nick, u->user, u->host,
                                                        rw->regex, rw->reason);
-                                       kline_sts("*", "*", u->host, 86400, rw->reason);
+                                       if (! (u->flags & UF_KLINESENT)) {
+                                               kline_sts("*", "*", u->host, 86400, rw->reason);
+                                               u->flags |= UF_KLINESENT;
+                                       }
                                }
                        }
                        else if (rw->actions & RWACT_QUARANTINE)
index d8f89fc21b3c228b373c540c387f2b8211fb2152..3c91e35bee03f29c5e649fb55ada805a030c39f0 100644 (file)
@@ -499,10 +499,13 @@ static void dnsbl_hit(user_t *u, struct Blacklist *blptr)
        }
        else if (!strcasecmp("KLINE", action))
        {
-               slog(LG_INFO, "DNSBL: k-lining \2%s\2!%s@%s [%s] who is listed in DNS Blacklist %s.", u->nick, u->user, u->host, u->gecos, blptr->host);
-               /* abort_blacklist_queries(u); */
-               notice(svs->nick, u->nick, "Your IP address %s is listed in DNS Blacklist %s", u->ip, blptr->host);
-               kline_sts("*", "*", u->host, 86400, "Banned (DNS Blacklist)");
+               if (! (u->flags & UF_KLINESENT)) {
+                       slog(LG_INFO, "DNSBL: k-lining \2%s\2!%s@%s [%s] who is listed in DNS Blacklist %s.", u->nick, u->user, u->host, u->gecos, blptr->host);
+                       /* abort_blacklist_queries(u); */
+                       notice(svs->nick, u->nick, "Your IP address %s is listed in DNS Blacklist %s", u->ip, blptr->host);
+                       kline_sts("*", "*", u->host, 86400, "Banned (DNS Blacklist)");
+                       u->flags |= UF_KLINESENT;
+               }
                return;
        }
 }