]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Whoops, ++it++? Thats gonna break :p
[user/henk/code/inspircd.git] / src / users.cpp
index 2cec79a95f7d0fecd4d22a13bb059eb44a599a13..906a2e9c3dccda8936052850b3ccae66d11cc3ba 100644 (file)
  * ---------------------------------------------------
  */
 
+#include "inspircd.h"
 #include "configreader.h"
 #include "channels.h"
 #include "users.h"
-#include "inspircd.h"
 #include <stdarg.h>
 #include "socketengine.h"
 #include "wildcard.h"
@@ -650,8 +650,12 @@ std::string userrec::GetBuffer()
                 * Usually there are only one or two of these,
                 * so its is computationally cheap to do.
                 */
-               while ((*recvq.begin() == '\r') || (*recvq.begin() == '\n'))
-                       recvq.erase(recvq.begin());
+               std::string::iterator t = recvq.begin();
+               while (t != recvq.end() && (*t == '\r' || *t == '\n'))
+               {
+                       recvq.erase(t);
+                       t = recvq.begin();
+               }
 
                for (std::string::iterator x = recvq.begin(); x != recvq.end(); x++)
                {
@@ -913,6 +917,13 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
         * See my note down there for why this is required. DO NOT REMOVE. :) -- w00t
         */
        ConnectClass* i = New->GetClass();
+
+       if (!i)
+       {
+               userrec::QuitUser(Instance, New, "Access denied by configuration");
+               return;
+       }
+
        New->CheckClass();
 
        New->pingmax = i->GetPingTime();