]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-info.c
New function IRC_KillClient() to kill clients
[ngircd-alex.git] / src / ngircd / irc-info.c
index 88455c74d9e85c770442aea1aa6f0c54e2e0ab9c..79a157c24bf658fb91309ba65c566dff4ab9322a 100644 (file)
@@ -41,6 +41,7 @@
 #include "irc-macros.h"
 #include "irc-write.h"
 #include "client-cap.h"
+#include "op.h"
 
 #include "exp.h"
 #include "irc-info.h"
@@ -865,6 +866,7 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
        unsigned int days, hrs, mins;
        struct list_head *list;
        struct list_elem *list_item;
+       bool more_links = false;
 
        assert(Client != NULL);
        assert(Req != NULL);
@@ -909,16 +911,20 @@ IRC_STATS( CLIENT *Client, REQUEST *Req )
                                list_item = Lists_GetNext(list_item);
                        }
                break;
+       case 'L':       /* Link status (servers and user links) */
+               if (!Op_Check(from, Req))
+                       return Op_NoPrivileges(from, Req);
+               more_links = true;
+
        case 'l':       /* Link status (servers and own link) */
-       case 'L':
                time_now = time(NULL);
                for (con = Conn_First(); con != NONE; con = Conn_Next(con)) {
                        cl = Conn_GetClient(con);
                        if (!cl)
                                continue;
-                       if ((Client_Type(cl) == CLIENT_SERVER)
-                           || (cl == Client)) {
-                               /* Server link or our own connection */
+                       if (Client_Type(cl) == CLIENT_SERVER ||
+                           cl == Client ||
+                           (more_links && Client_Type(cl) == CLIENT_USER)) {
 #ifdef ZLIB
                                if (Conn_Options(con) & CONN_ZIP) {
                                        if (!IRC_WriteStrClient
@@ -1146,11 +1152,13 @@ IRC_WHO(CLIENT *Client, REQUEST *Req)
                if (strcmp(Req->argv[1], "o") == 0)
                        only_ops = true;
 #ifdef STRICT_RFC
-               else
+               else {
+                       IRC_SetPenalty(Client, 2);
                        return IRC_WriteErrClient(Client,
                                                  ERR_NEEDMOREPARAMS_MSG,
                                                  Client_ID(Client),
                                                  Req->command);
+               }
 #endif
        }