summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-10-07 19:04:40 -0400
committerAdam <Adam@anope.org>2016-10-07 19:04:40 -0400
commit9e01480253fa40b822e0488be24a2c08bce500e2 (patch)
treec452fd4dfbedf3ed8fd97f34d9ae6e01b2e4564b
parent454be59a5d0cb33585f58e73f15a758cf5f67327 (diff)
Add/fix various checks on source user existing in the protocol modules
-rw-r--r--modules/protocol/bahamut.cpp7
-rw-r--r--modules/protocol/charybdis.cpp16
-rw-r--r--modules/protocol/ngircd.cpp5
-rw-r--r--modules/protocol/unreal.cpp7
4 files changed, 27 insertions, 8 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 9b0adefb0..988cfaead 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -410,7 +410,12 @@ struct IRCDMessageNick : IRCDMessage
User::OnIntroduce(params[0], params[4], params[5], "", params[8], s, params[9], signon, params[3], "", na ? na->GetAccount() : NULL);
}
else
- source.GetUser()->ChangeNick(params[0]);
+ {
+ User *u = source.GetUser();
+
+ if (u)
+ u->ChangeNick(params[0]);
+ }
}
};
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index aabb77718..b65c76f37 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -215,19 +215,25 @@ class CharybdisProto : public IRCDProto
void charybdis::Encap::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
- User *u = source.GetUser();
-
// In a burst, states that the source user is logged in as the account.
if (params[1] == "LOGIN" || params[1] == "SU")
{
+ User *u = source.GetUser();
NickServ::Account *nc = NickServ::FindAccount(params[2]);
- if (!nc)
+
+ if (!u || !nc)
return;
+
u->Login(nc);
}
// Received: :42XAAAAAE ENCAP * CERTFP :3f122a9cc7811dbad3566bf2cec3009007c0868f
- if (params[1] == "CERTFP")
+ else if (params[1] == "CERTFP")
{
+ User *u = source.GetUser();
+
+ if (!u)
+ return;
+
u->fingerprint = params[2];
EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u);
}
@@ -242,7 +248,7 @@ void charybdis::Encap::Run(MessageSource &source, const std::vector<Anope::strin
*
* Charybdis only accepts messages from SASL agents; these must have umode +S
*/
- if (params[1] == "SASL" && sasl && params.size() >= 6)
+ else if (params[1] == "SASL" && sasl && params.size() >= 6)
{
SASL::Message m;
m.source = params[2];
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index be8225b96..2c03ed434 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -457,7 +457,10 @@ struct IRCDMessageNick : IRCDMessage
if (params.size() == 1)
{
// we have a nickchange
- source.GetUser()->ChangeNick(params[0]);
+ User *u = source.GetUser();
+
+ if (u)
+ u->ChangeNick(params[0]);
}
else if (params.size() == 7)
{
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 0f97da8ae..1eb40f4c3 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -821,7 +821,12 @@ struct IRCDMessageNick : IRCDMessage
User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? na->GetAccount() : NULL);
}
else
- source.GetUser()->ChangeNick(params[0]);
+ {
+ User *u = source.GetUser();
+
+ if (u)
+ u->ChangeNick(params[0]);
+ }
}
};