aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-08-01 19:42:57 +0100
committerGravatar Sadie Powell2021-08-01 20:14:47 +0100
commita7301475860b513d96bb136b18843591cedef4dc (patch)
tree32298f02f98577d9ae7a9d3d958832b139f4eb56 /src
parentMerge branch 'insp3' into master. (diff)
parentRemove the root checks from the helper script. (diff)
Merge branch 'insp3' into master.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_hostname_lookup.cpp11
-rw-r--r--src/users.cpp4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/coremods/core_hostname_lookup.cpp b/src/coremods/core_hostname_lookup.cpp
index 201a36473..db221e5f0 100644
--- a/src/coremods/core_hostname_lookup.cpp
+++ b/src/coremods/core_hostname_lookup.cpp
@@ -33,6 +33,9 @@ namespace
class UserResolver : public DNS::Request
{
private:
+ /** The socket address that the user we are looking up is connected from. */
+ const irc::sockets::sockaddrs sa;
+
/** UUID we are looking up */
const std::string uuid;
@@ -57,6 +60,7 @@ class UserResolver : public DNS::Request
*/
UserResolver(DNS::Manager* mgr, Module* me, LocalUser* user, const std::string& to_resolve, DNS::QueryType qt)
: DNS::Request(mgr, me, to_resolve, qt)
+ , sa(user->client_sa)
, uuid(user->uuid)
{
}
@@ -68,11 +72,8 @@ class UserResolver : public DNS::Request
void OnLookupComplete(const DNS::Query* r) override
{
LocalUser* bound_user = IS_LOCAL(ServerInstance->Users.FindUUID(uuid));
- if (!bound_user)
- {
- ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Resolution finished for user '%s' who is gone", uuid.c_str());
+ if (!bound_user || bound_user->client_sa != sa)
return;
- }
const DNS::ResourceRecord* ans_record = r->FindAnswerOfType(this->question.type);
if (ans_record == NULL)
@@ -145,7 +146,7 @@ class UserResolver : public DNS::Request
void OnError(const DNS::Query* query) override
{
LocalUser* bound_user = IS_LOCAL(ServerInstance->Users.FindUUID(uuid));
- if (bound_user)
+ if (bound_user && bound_user->client_sa == sa)
HandleError(bound_user, "Could not resolve your hostname: " + this->manager->GetErrorStr(query->error));
}
};
diff --git a/src/users.cpp b/src/users.cpp
index cb5e4e4ab..8641c0d45 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -887,7 +887,7 @@ void User::WriteCommonRaw(ClientProtocol::Event& protoev, bool include_self)
ForEachNeighbor(handler, include_self);
}
-void User::ForEachNeighbor(ForEachNeighborHandler& handler, bool include_self)
+uint64_t User::ForEachNeighbor(ForEachNeighborHandler& handler, bool include_self)
{
// The basic logic for visiting the neighbors of a user is to iterate the channel list of the user
// and visit all users on those channels. Because two users may share more than one common channel,
@@ -936,6 +936,8 @@ void User::ForEachNeighbor(ForEachNeighborHandler& handler, bool include_self)
}
}
}
+
+ return newid;
}
void User::WriteRemoteNumeric(const Numeric::Numeric& numeric)