diff options
author | Peter Powell <petpow@saberuk.com> | 2019-10-11 12:21:16 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-10-13 22:05:19 +0100 |
commit | dd24f8ac713793d5d5a7e959228937f48788ba66 (patch) | |
tree | 1f55ed9c83ad62acdb628f77f0b347044f26d61a /src/modules | |
parent | f751aef21057d8b4be40cdb697982ea3e53e992c (diff) |
Convert a bunch of LocalUser* casts to IS_LOCAL.
This is a lot safer and handles users changing servers properly.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_cloaking.cpp | 6 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_ldapauth.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_namedmodes.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_sqlauth.cpp | 2 |
5 files changed, 11 insertions, 8 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index c5db9ff8a..eab28db4a 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -375,12 +375,14 @@ class ModuleCloaking : public Module { u->SetMode(cu, false); - if (!IS_LOCAL(u)) + LocalUser* luser = IS_LOCAL(u); + if (!luser) return; + Modes::ChangeList modechangelist; modechangelist.push_remove(&cu); ClientProtocol::Events::Mode modeevent(ServerInstance->FakeClient, NULL, u, modechangelist); - static_cast<LocalUser*>(u)->Send(modeevent); + luser->Send(modeevent); } cu.active = false; } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 9a9ad85a2..c9be107b8 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -63,7 +63,7 @@ class DNSBLResolver : public DNS::Request void OnLookupComplete(const DNS::Query *r) CXX11_OVERRIDE { /* Check the user still exists */ - LocalUser* them = (LocalUser*)ServerInstance->FindUUID(theiruid); + LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid)); if (!them) return; @@ -209,7 +209,7 @@ class DNSBLResolver : public DNS::Request void OnError(const DNS::Query *q) CXX11_OVERRIDE { - LocalUser* them = (LocalUser*)ServerInstance->FindUUID(theiruid); + LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid)); if (!them) return; diff --git a/src/modules/m_ldapauth.cpp b/src/modules/m_ldapauth.cpp index b833b9384..845fc6fbd 100644 --- a/src/modules/m_ldapauth.cpp +++ b/src/modules/m_ldapauth.cpp @@ -216,7 +216,7 @@ class SearchInterface : public LDAPInterface void OnResult(const LDAPResult& r) CXX11_OVERRIDE { - LocalUser* user = static_cast<LocalUser*>(ServerInstance->FindUUID(uid)); + LocalUser* user = IS_LOCAL(ServerInstance->FindUUID(uid)); dynamic_reference<LDAPProvider> LDAP(me, provider); if (!LDAP || r.empty() || !user) { diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 2fbdca265..af520080f 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -113,8 +113,9 @@ class DummyZ : public ModeHandler // Handle /MODE #chan Z void DisplayList(User* user, Channel* chan) CXX11_OVERRIDE { - if (IS_LOCAL(user)) - ::DisplayList(static_cast<LocalUser*>(user), chan); + LocalUser* luser = IS_LOCAL(user); + if (luser) + ::DisplayList(luser, chan); } }; diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp index 54ff7e088..503215eb2 100644 --- a/src/modules/m_sqlauth.cpp +++ b/src/modules/m_sqlauth.cpp @@ -49,7 +49,7 @@ class AuthQuery : public SQL::Query void OnResult(SQL::Result& res) CXX11_OVERRIDE { - LocalUser* user = static_cast<LocalUser*>(ServerInstance->FindUUID(uid)); + LocalUser* user = IS_LOCAL(ServerInstance->FindUUID(uid)); if (!user) return; |