aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/m_ident.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-05-02 19:40:36 +0000
committerGravatar brain2006-05-02 19:40:36 +0000
commit63fd36985b789fa3cb979ec886cd0aa6ca4efaae (patch)
treed208948fad544946b20697e154414d23d15ce826 /src/modules/m_ident.cpp
parentMerge of peaveydk's diff (at last) (diff)
Now doesnt crash on rare occaisions
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@3924 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_ident.cpp')
-rw-r--r--src/modules/m_ident.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 9136d1349..10e458422 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -117,19 +117,26 @@ class RFC1413 : public InspSocket
virtual bool OnConnected()
{
- uslen = sizeof(sock_us);
- themlen = sizeof(sock_them);
- if ((getsockname(this->u->fd,(sockaddr*)&sock_us,&uslen) || getpeername(this->u->fd, (sockaddr*)&sock_them, &themlen)))
+ if (u)
{
- Srv->Log(DEBUG,"Ident: failed to get socket names, bailing");
- return false;
+ uslen = sizeof(sock_us);
+ themlen = sizeof(sock_them);
+ if ((getsockname(this->u->fd,(sockaddr*)&sock_us,&uslen) || getpeername(this->u->fd, (sockaddr*)&sock_them, &themlen)))
+ {
+ Srv->Log(DEBUG,"Ident: failed to get socket names, bailing");
+ return false;
+ }
+ else
+ {
+ // send the request in the following format: theirsocket,oursocket
+ snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
+ this->Write(ident_request);
+ Srv->Log(DEBUG,"Sent ident request, waiting for reply");
+ return true;
+ }
}
else
{
- // send the request in the following format: theirsocket,oursocket
- snprintf(ident_request,127,"%d,%d\r\n",ntohs(sock_them.sin_port),ntohs(sock_us.sin_port));
- this->Write(ident_request);
- Srv->Log(DEBUG,"Sent ident request, waiting for reply");
return true;
}
}
@@ -233,6 +240,7 @@ class ModuleIdent : public Module
RFC1413* ident = (RFC1413*)user->GetExt("ident_data");
if (ident)
{
+ ident->u = NULL;
Srv->RemoveSocket(ident);
}
}