summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 21:04:04 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-01 21:04:04 +0000
commit7f4395d336c331dd434bca91b6273c072f26e1bc (patch)
tree9b8114cab35b34701c9d72811e7738bcae976bfb /src
parentfba70f50c5b135e5e0e7f95c7d834c01cbbaa824 (diff)
Fixed 'unlikely' crash if nick was changed before dns lookup was completed
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@942 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/commands.cpp6
-rw-r--r--src/inspircd.cpp13
2 files changed, 10 insertions, 9 deletions
diff --git a/src/commands.cpp b/src/commands.cpp
index 7eed17478..0af56645d 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -51,6 +51,7 @@
#include "mode.h"
#include "xline.h"
#include "inspstring.h"
+#include "dnsqueue.h"
#ifdef GCC3
#define nspace __gnu_cxx
@@ -1638,7 +1639,12 @@ void handle_nick(char **parameters, int pcnt, userrec *user)
log(DEBUG,"new nick set: %s",user->nick);
if (user->registered < 3)
+ {
user->registered = (user->registered | 2);
+ // dont attempt to look up the dns until they pick a nick... because otherwise their pointer WILL change
+ // and unless we're lucky we'll get a duff one later on.
+ lookup_dns(user);
+ }
if (user->registered == 3)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 989e3e6b7..5a16c9851 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -1933,6 +1933,7 @@ void kill_link(userrec *user,const char* r)
if (user->registered == 7) {
purge_empty_chans();
}
+ user = NULL;
}
void kill_link_silent(userrec *user,const char* r)
@@ -2213,8 +2214,6 @@ void AddClient(int socket, char* host, int port, bool iscached, char* ip)
clientlist[tempnick]->port = port;
strncpy(clientlist[tempnick]->ip,ip,32);
- lookup_dns(clientlist[tempnick]);
-
// set the registration timeout for this user
unsigned long class_regtimeout = 90;
for (ClassVector::iterator i = Classes.begin(); i != Classes.end(); i++)
@@ -2464,11 +2463,6 @@ void HandlePendingConnects()
return;
}
}
- else
- {
- pending_connects.erase(i);
- return;
- }
}
}
}
@@ -3471,9 +3465,10 @@ int InspIRCd(void)
{
for( int n = 0; n < fd_reap.size(); n++)
{
- Blocking(fd_reap[n]);
+ //Blocking(fd_reap[n]);
close(fd_reap[n]);
- NonBlocking(fd_reap[n]);
+ shutdown (fd_reap[n],2);
+ //NonBlocking(fd_reap[n]);
}
}
fd_reap.clear();