summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-19 08:15:54 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-02-19 08:15:54 +0000
commitbe4c8f3f21f6b5c1a56a60d5843a62d5a3321039 (patch)
tree5c3b0380937253278ff15ec3262e28d97771bc70 /src/modules.cpp
parent65735fefd6022aefa1a2d9d4fbcc72dda25ac5b5 (diff)
Fix for crashbugs when quitting users as experienced by satmd, SiliconAI and others.
QA: Please test combinations of /quit, /kill, and friends. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6595 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp50
1 files changed, 4 insertions, 46 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 83b88b2fa..7505dd21e 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -449,56 +449,14 @@ bool InspIRCd::AddResolver(Resolver* r, bool cached)
bool InspIRCd::UserToPseudo(userrec* user, const std::string &message)
{
- unsigned int old_fd = user->GetFd();
- user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
- user->FlushWriteBuf();
- user->ClearBuffer();
- user->SetFd(FD_MAGIC_NUMBER);
-
- if (find(local_users.begin(),local_users.end(),user) != local_users.end())
- {
- local_users.erase(find(local_users.begin(),local_users.end(),user));
- }
-
- this->SE->DelFd(user);
- shutdown(old_fd,2);
- close(old_fd);
- return true;
+ throw CoreException("The InspIRCd::UsertoPseudo function should not be used in InspIRCd later than 1.0.x");
+ return false;
}
bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &message)
{
- zombie->SetFd(alive->GetFd());
- FOREACH_MOD_I(this,I_OnUserQuit,OnUserQuit(alive,message));
- alive->SetFd(FD_MAGIC_NUMBER);
- alive->FlushWriteBuf();
- alive->ClearBuffer();
- // save these for later
- std::string oldnick = alive->nick;
- std::string oldhost = alive->host;
- std::string oldident = alive->ident;
- userrec::QuitUser(this,alive,message.c_str());
- if (find(local_users.begin(),local_users.end(),alive) != local_users.end())
- {
- local_users.erase(find(local_users.begin(),local_users.end(),alive));
- }
- // Fix by brain - cant write the user until their fd table entry is updated
- zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
- for (UCListIter i = zombie->chans.begin(); i != zombie->chans.end(); i++)
- {
- chanrec* Ptr = i->first;
- zombie->WriteFrom(zombie,"JOIN %s",Ptr->name);
- if (Ptr->topicset)
- {
- zombie->WriteServ("332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
- zombie->WriteServ("333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
- }
- Ptr->UserList(zombie);
- zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
- }
- if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->GetFd() != FD_MAGIC_NUMBER))
- local_users.push_back(zombie);
- return true;
+ throw CoreException("The InspIRCd::PseudotoUser function should not be used in InspIRCd later than 1.0.x");
+ return false;
}
void InspIRCd::AddGLine(long duration, const std::string &source, const std::string &reason, const std::string &hostmask)