about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2013-10-01 12:09:59 +0200
committerAlexander Barton <alex@barton.de>2013-10-01 12:26:34 +0200
commit2798a12444bce91613388ceb7ab52d1e97787687 (patch)
treed33c77d69c9775d6ccd29f7d8f043c0334dd06a6
parent02182143c30288b54cf84325c796ec9b7a7b2d34 (diff)
downloadngircd-2798a12444bce91613388ceb7ab52d1e97787687.tar.gz
ngircd-2798a12444bce91613388ceb7ab52d1e97787687.zip
Actually KILL clients on GLINE/KLINE
Kill all clients that match a new GLINE/KLINE mask and genrate apropriate
KILL commands. These KILL commands can be superfluous, but are required
when the IRC Operator isn't allowd to set remote G-Lines or if there are
older servers in the network that don't kill clients on GLINE/KLINE.

Closes bug #156.
-rw-r--r--src/ngircd/irc-oper.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c
index 74f17cc0..4ccc76a6 100644
--- a/src/ngircd/irc-oper.c
+++ b/src/ngircd/irc-oper.c
@@ -28,12 +28,14 @@
 #include "conf.h"
 #include "channel.h"
 #include "class.h"
+#include "parse.h"
+#include "irc.h"
 #include "irc-macros.h"
 #include "irc-write.h"
+#include "lists.h"
 #include "log.h"
 #include "match.h"
 #include "messages.h"
-#include "parse.h"
 #include "op.h"
 
 #include <exp.h>
@@ -384,9 +386,10 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req )
 GLOBAL bool
 IRC_xLINE(CLIENT *Client, REQUEST *Req)
 {
-	CLIENT *from;
+	CLIENT *from, *c, *c_next;
+	char reason[COMMAND_LEN], class_c;
+	struct list_head *list;
 	int class;
-	char class_c;
 
 	assert(Client != NULL);
 	assert(Req != NULL);
@@ -446,6 +449,20 @@ IRC_xLINE(CLIENT *Client, REQUEST *Req)
 						Req->argv[0], Req->argv[1],
 						Req->argv[2]);
 			}
+
+			/* Check currently connected clients */
+			snprintf(reason, sizeof(reason), "%c-Line by \"%s\": \"%s\"",
+				 class_c, Client_ID(from), Req->argv[2]);
+			list = Class_GetList(class);
+			c = Client_First();
+			while (c) {
+				c_next = Client_Next(c);
+				if ((class == CLASS_GLINE || Client_Conn(c) > NONE)
+				    && Lists_Check(list, c))
+					IRC_KillClient(Client, NULL,
+						       Client_ID(c), reason);
+				c = c_next;
+			}
 		}
 	}