]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
(TEST CODE) remote ping, do not use until debugged
[user/henk/code/inspircd.git] / src / command_parse.cpp
index eaf596a9869d5ada2445f99d6e41f5b7c6d0a43d..311def7d2f0451a53f6ea5dbdd8ce3d23930e9a4 100644 (file)
@@ -168,7 +168,7 @@ int CommandParser::LoopCall(command_t* fn, char **parameters, int pcnt, userrec
                         plist[i] = '\0';
                         strlcpy(blog[j++],param,MAXBUF);
                         param = plist+i+1;
-                        if (j>20)
+                        if ((unsigned int)j > Config->MaxTargets)
                         {
                                 WriteServ(u->fd,"407 %s %s :Too many targets in list, message not delivered.",u->nick,blog[j-1]);
                                 return 1;
@@ -475,9 +475,9 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
                 }
                 else
                 {
-                        for (unsigned int i = 0; i <= strlen(cmd); i++)
+                        for (char* i = cmd; *i; i++)
                         {
-                                cmd[i] = toupper(cmd[i]);
+                                *i = toupper(*i);
                         }
                 }
 
@@ -506,6 +506,11 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
         }
 
         std::string xcommand = command;
+       if ((user->registered != 7) && (xcommand == "SERVER"))
+       {
+               kill_link(user,"Server connection to non-server port");
+               return;
+       }
        
        /* Tweak by brain - why was this INSIDE the mainloop? */
        if (parameters)
@@ -536,17 +541,16 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
        
         if (cm != cmdlist.end())
         {
-                        
-                                if (user)
+                        if (user)
+                        {
+                                /* activity resets the ping pending timer */
+                                user->nping = TIME + user->pingmax;
+                                if ((items) < cm->second->min_params)
                                 {
-                                        /* activity resets the ping pending timer */
-                                        user->nping = TIME + user->pingmax;
-                                        if ((items) < cm->second->min_params)
-                                        {
-                                                log(DEBUG,"not enough parameters: %s %s",user->nick,command);
-                                                WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command);
-                                                return;
-                                        }
+                                        log(DEBUG,"not enough parameters: %s %s",user->nick,command);
+                                        WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command);
+                                        return;
+                                }
                                         if ((!strchr(user->modes,cm->second->flags_needed)) && (cm->second->flags_needed))
                                         {
                                                 log(DEBUG,"permission denied: %s %s",user->nick,command);