]> jfr.im git - solanum.git/blobdiff - src/parse.c
Remove s_assert definition from ircd_defs.h and add it to its own header.
[solanum.git] / src / parse.c
index 37d0c88f0fd93145bffbb8e885b2062188aa7aec..44dfd64e4bbc5c834e8400a9e48f196151db1318 100644 (file)
 #include "s_conf.h"
 #include "s_serv.h"
 #include "packet.h"
+#include "s_assert.h"
 
 static struct Dictionary *cmd_dict = NULL;
 struct Dictionary *alias_dict = NULL;
 
-/*
- * NOTE: parse() should not be called recursively by other functions!
- */
-static char *sender;
-
 /* parv[0] is not used, and parv[LAST] == NULL */
 static char *para[MAXPARA + 2];
 
@@ -117,12 +113,13 @@ string_to_array(char *string, char **parv)
 
 /* parse()
  *
- * given a raw buffer, parses it and generates parv, parc and sender
+ * given a raw buffer, parses it and generates parv and parc
  */
 void
 parse(struct Client *client_p, char *pbuffer, char *bufend)
 {
        struct Client *from = client_p;
+       char *sender;
        char *ch;
        char *s;
        char *end;
@@ -131,7 +128,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
        struct Message *mptr;
 
        s_assert(MyConnect(client_p));
-       s_assert(client_p->localClient->F->fd >= 0);
+       s_assert(client_p->localClient->F != NULL);
        if(IsAnyDead(client_p))
                return;
 
@@ -532,6 +529,8 @@ static void
 remove_unknown(struct Client *client_p, char *lsender, char *lbuffer)
 {
        int slen = strlen(lsender);
+       char sid[4];
+       struct Client *server;
 
        /* meepfoo      is a nickname (ignore)
         * #XXXXXXXX    is a UID (KILL)
@@ -550,9 +549,21 @@ remove_unknown(struct Client *client_p, char *lsender, char *lbuffer)
                           get_id(&me, client_p), lsender, 
                           lbuffer, client_p->name);
        }
-       else if(IsDigit(lsender[0]))
-               sendto_one(client_p, ":%s KILL %s :%s (Unknown Client)", 
-                          get_id(&me, client_p), lsender, me.name);
+       else if(!IsDigit(lsender[0]))
+               ;
+       else if(slen != 9)
+               sendto_realops_snomask(SNO_DEBUG, L_ALL,
+                                    "Invalid prefix (%s) from %s",
+                                    lbuffer, client_p->name);
+       else
+       {
+               memcpy(sid, lsender, 3);
+               sid[3] = '\0';
+               server = find_server(NULL, sid);
+               if (server != NULL && server->from == client_p)
+                       sendto_one(client_p, ":%s KILL %s :%s (Unknown Client)", 
+                                       get_id(&me, client_p), lsender, me.name);
+       }
 }