summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-05 11:00:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2004-04-05 11:00:20 +0000
commit052dde3aead635863aaefbdafeae5daa6d8eecf8 (patch)
treebdebefbab0d21788c3013d08f7b07acbf23ed5c5 /src
parent7ceac8fd6fe755e3374e9f809a11179733ca038a (diff)
Fix for bug ID #5 (PING, PONG And other matters)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@386 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/InspIRCd.layout16
-rw-r--r--src/inspircd.cpp34
-rw-r--r--src/users.cpp1
3 files changed, 41 insertions, 10 deletions
diff --git a/src/InspIRCd.layout b/src/InspIRCd.layout
index 325358fb1..aaa0daa11 100644
--- a/src/InspIRCd.layout
+++ b/src/InspIRCd.layout
@@ -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]
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index b998658f4..26c952062 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -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)
diff --git a/src/users.cpp b/src/users.cpp
index 857e2f1d6..3211a029f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -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,"");