diff options
author | Adam <Adam@anope.org> | 2013-07-26 07:36:17 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-26 07:38:42 -0400 |
commit | 2450a64bf4dc55635c9f4c1c829f149dc6621b41 (patch) | |
tree | e946c4a76eb841b80671d6da6d6ad3e3a56a0711 | |
parent | b48293a6327a5e28baf528cda004c1d5aeea872d (diff) |
Interally quit servers when juped
-rw-r--r-- | modules/commands/os_jupe.cpp | 4 | ||||
-rw-r--r-- | src/messages.cpp | 4 | ||||
-rw-r--r-- | src/protocol.cpp | 3 | ||||
-rw-r--r-- | src/servers.cpp | 3 | ||||
-rw-r--r-- | src/uplink.cpp | 7 |
5 files changed, 15 insertions, 6 deletions
diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index fbade0e82..429c5e998 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -33,9 +33,11 @@ class CommandOSJupe : public Command else { Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); + /* Generate the new sid before quitting the old server, so they can't collide */ + Anope::string sid = Servers::TS6_SID_Retrieve(); if (server) IRCD->SendSquit(server, rbuf); - Server *juped_server = new Server(Me, jserver, 1, rbuf, Servers::TS6_SID_Retrieve(), true); + Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true); IRCD->SendServer(juped_server); Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; diff --git a/src/messages.cpp b/src/messages.cpp index a0c5e6dfb..a41cd6ba3 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -375,12 +375,10 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) if (!s) { - Log() << "SQUIT for nonexistent server " << params[0]; + Log(LOG_DEBUG) << "SQUIT for nonexistent server " << params[0]; return; } - FOREACH_MOD(OnServerQuit, (s)); - s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); } diff --git a/src/protocol.cpp b/src/protocol.cpp index ccd58c95f..15b39b971 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -263,7 +263,8 @@ void IRCDProto::SendGlobops(const BotInfo *source, const char *fmt, ...) void IRCDProto::SendSquit(Server *s, const Anope::string &message) { - UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message; + UplinkSocket::Message() << "SQUIT " << s->GetSID() << " :" << message; + s->Delete(message); } void IRCDProto::SendNickChange(const User *u, const Anope::string &newnick) diff --git a/src/servers.cpp b/src/servers.cpp index ee4891138..77431eeab 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -178,7 +178,10 @@ const Anope::string &Server::GetDescription() const void Server::SetSID(const Anope::string &nsid) { + if (!this->sid.empty()) + throw CoreException("Server already has an id?"); this->sid = nsid; + Servers::ByID[nsid] = this; } const Anope::string &Server::GetSID() const diff --git a/src/uplink.cpp b/src/uplink.cpp index 871121cc9..282d8be05 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -173,7 +173,12 @@ UplinkSocket::Message::~Message() } else if (this->user != NULL) { - if (this->user->server != Me && !this->user->server->IsJuped()) + if (this->user->server == NULL) + { + Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->user->nick << " who has no server (I'm not introduced?)"; + return; + } + else if (this->user->server != Me && !this->user->server->IsJuped()) { Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->user->nick << " who is not from me?"; return; |