summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-13 21:53:55 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-13 21:53:55 +0000
commit5f45e12a4d05140e959d76dbbf83c6c247cd01d0 (patch)
treeb7c57a2f0eca6779ed5c45a139b6a273fd048596
parent28eb93f09676e346eefb5c7f588ba5e15f9bdc9e (diff)
IMPORTANT checks in here that special took out thinking they were no longer required. Because of the fact that the inspsocket cull comes after the user cull these *are* required.
This was bought up in discussion many weeks ago but i guess we both thought the other had added these back! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8159 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_ident.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index 9588bb3e7..709cf67a4 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -22,15 +22,23 @@ class IdentRequestSocket : public InspSocket
{
private:
userrec *user;
+ int original_fd;
public:
IdentRequestSocket(InspIRCd *Server, userrec *user, int timeout, const std::string &bindip)
: InspSocket(Server, user->GetIPString(), 113, false, timeout, bindip), user(user)
{
-
+ original_fd = user->GetFd();
+ Instance->Log(DEBUG, "Ident request against user with fd %d", original_fd);
}
-
+
virtual bool OnConnected()
{
+ if (Instance->SE->GetRef(original_fd) == user)
+ {
+ Instance->Log(DEBUG,"Oh dear, our user has gone AWOL on fd %d", original_fd);
+ return false;
+ }
+
/* Both sockaddr_in and sockaddr_in6 can be safely casted to sockaddr, especially since the
* only members we use are in a part of the struct that should always be identical (at the
* byte level). */
@@ -70,7 +78,14 @@ class IdentRequestSocket : public InspSocket
/* There used to be a check against the fd table here, to make sure the user hadn't been
* deleted but not yet had their socket closed or something along those lines, dated june
* 2006. Since we added the global cull list and such, I don't *think* that is necessary
- * anymore. If you're getting odd crashes here, that's probably why ;) -Special */
+ *
+ * -- YES IT IS!!!! DO NOT REMOVE IT, THIS IS WHAT THE WARNING ABOVE THE OLD CODE SAID :P
+ */
+ if (Instance->SE->GetRef(original_fd) == user)
+ {
+ Instance->Log(DEBUG,"Oh dear, our user has gone AWOL on fd %d", original_fd);
+ return;
+ }
if (*user->ident == '~' && user->GetExt("ident_socket"))
user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead", user->ident);
@@ -81,6 +96,12 @@ class IdentRequestSocket : public InspSocket
virtual void OnError(InspSocketError e)
{
+ if (Instance->SE->GetRef(original_fd) == user)
+ {
+ Instance->Log(DEBUG,"Oh dear, our user has gone AWOL on fd %d", original_fd);
+ return;
+ }
+
// Quick check to make sure that this hasn't been sent ;)
if (*user->ident == '~' && user->GetExt("ident_socket"))
user->WriteServ("NOTICE Auth :*** Could not find your ident, using %s instead", user->ident);
@@ -91,6 +112,12 @@ class IdentRequestSocket : public InspSocket
virtual bool OnDataReady()
{
+ if (Instance->SE->GetRef(original_fd) == user)
+ {
+ Instance->Log(DEBUG,"Oh dear, our user has gone AWOL on fd %d", original_fd);
+ return false;
+ }
+
char *ibuf = this->Read();
if (!ibuf)
return false;