]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix for bug ID #5 (PING, PONG And other matters)
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 5 Apr 2004 11:00:20 +0000 (11:00 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 5 Apr 2004 11:00:20 +0000 (11:00 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@386 e03df62e-2008-0410-955e-edbf42e46eb7

include/users.h
src/InspIRCd.layout
src/inspircd.cpp
src/users.cpp

index 8a71bf67e147337065c98c6318c63e82af433549..d20de55a3a83ca181763e91ee9548e233b304383 100644 (file)
@@ -113,6 +113,8 @@ class userrec : public connection
         */
        char result[256];
        
+       unsigned long timeout;
+
        userrec();
        
        virtual ~userrec() {  }
index 325358fb1ca6e17b2ff14a53f9b60e3a31954e03..aaa0daa11bf1c3de61f3bf30bc7a790be1dcdee6 100644 (file)
@@ -13,9 +13,9 @@ LeftChar=1
 [Editor_1]
 Open=1
 Top=1
-CursorCol=54
-CursorRow=5298
-TopLine=5263
+CursorCol=22
+CursorRow=5263
+TopLine=5236
 LeftChar=1
 
 [Editor_2]
@@ -53,8 +53,8 @@ LeftChar=1
 [Editor_6]
 Open=1
 Top=0
-CursorCol=22
-CursorRow=51
+CursorCol=2
+CursorRow=16
 TopLine=1
 LeftChar=1
 
@@ -181,9 +181,9 @@ LeftChar=1
 [Editor_22]
 Open=1
 Top=0
-CursorCol=34
-CursorRow=50
-TopLine=1
+CursorCol=24
+CursorRow=116
+TopLine=71
 LeftChar=1
 
 [Editor_23]
index b998658f42fdfa928140ffcf2ea1e4eb5f320b6a..26c9520629269e42581749482454a9af3ff76575 100644 (file)
@@ -3195,6 +3195,7 @@ bool IsDenied(userrec *user)
 }
 
 
+
 void handle_pass(char **parameters, int pcnt, userrec *user)
 {
        if (!strcasecmp(parameters[0],Passwd(user)))
@@ -3308,7 +3309,15 @@ void send_error(char *s)
        log(DEBUG,"send_error: %s",s);
        for (user_hash::const_iterator i = clientlist.begin(); i != clientlist.end(); i++)
        {
-               WriteServ(i->second->fd,"NOTICE %s :%s",i->second->nick,s);
+               if (isnick(i->second->nick))
+               {
+                       WriteServ(i->second->fd,"NOTICE %s :%s",i->second->nick,s);
+               }
+               else
+               {
+                       // fix - unregistered connections receive ERROR, not NOTICE
+                       Write(i->second->fd,"ERROR :%s",s);
+               }
        }
 }
 
@@ -3467,12 +3476,12 @@ void AddClient(int socket, char* host, int port, bool iscached)
        NonBlocking(socket);
        log(DEBUG,"AddClient: %d %s %d",socket,host,port);
 
-
        clientlist[tempnick]->fd = socket;
        strncpy(clientlist[tempnick]->nick, tn2,NICKMAX);
        strncpy(clientlist[tempnick]->host, host,160);
        strncpy(clientlist[tempnick]->dhost, host,160);
        strncpy(clientlist[tempnick]->server, ServerName,256);
+       strncpy(clientlist[tempnick]->ident, "unknown",9);
        clientlist[tempnick]->registered = 0;
        clientlist[tempnick]->signon = time(NULL);
        clientlist[tempnick]->nping = time(NULL)+240;
@@ -3488,6 +3497,19 @@ void AddClient(int socket, char* host, int port, bool iscached)
                WriteServ(socket,"NOTICE Auth :Looking up your hostname...");
        }
 
+       // set the registration timeout for this user
+       unsigned long class_regtimeout = 90;
+       for (ClassVector::iterator i = Classes.begin(); i != Classes.end(); i++)
+       {
+               if (match(clientlist[tempnick]->host,i->host) && (i->type == CC_ALLOW))
+               {
+                       class_regtimeout = (unsigned long)i->registration_timeout;
+                       break;
+               }
+       }
+       log(DEBUG,"Client has a connection timeout value of %d",class_regtimeout);
+       clientlist[tempnick]->timeout = time(NULL)+class_regtimeout;
+
        if (clientlist.size() == MAXCLIENTS)
                kill_link(clientlist[tempnick],"No more connections allowed in this class");
 }
@@ -5237,6 +5259,14 @@ int InspIRCd(void)
                if (count2->second)
                if (count2->second->fd)
                {
+                       // registration timeout -- didnt send USER/NICK/HOST in the time specified in
+                       // their connection class.
+                       if ((time(NULL) > count2->second->timeout) && (count2->second->registered != 7)) 
+                       {
+                               log(DEBUG,"InspIRCd: registration timeout: %s",count2->second->nick);
+                               kill_link(count2->second,"Registration timeout");
+                               break;
+                       }
                        if (((time(NULL)) > count2->second->nping) && (isnick(count2->second->nick)) && (count2->second->registered == 7))
                        {
                                if (!count2->second->lastping) 
index 857e2f1d61db42e14eb23d300a9562c276e8db29..3211a029f6c2c8c3919a6841b38cdaa8f930f909 100644 (file)
@@ -13,6 +13,7 @@ userrec::userrec()
        // the PROPER way to do it, AVOID bzero at *ALL* costs
        strcpy(nick,"");
        ip = 0;
+       timeout = 0;
        strcpy(ident,"");
        strcpy(host,"");
        strcpy(dhost,"");