diff options
| author | 2023-06-29 16:29:56 +0100 | |
|---|---|---|
| committer | 2023-06-29 17:01:25 +0100 | |
| commit | 29705306f21d713c2928d8896f48a3cbb640eacc (patch) | |
| tree | 5642409ba5a61ab578eb84a11cce5ba81e493187 /src/modules/m_spanningtree/nickcollide.cpp | |
| parent | Merge branch 'insp3' into master. (diff) | |
Retain the "real" username properly like we do for hostnames.
This introduces the concept of a real username. This value comes
from either the initial USER message or from an ident lookup. Doing
this allows us to use it for bans through vidents and cloaking web
client users using their remote username.
While changing this I also changed all of the uses of "ident" other
than RFC 1413 lookups and some compatibility cases to refer to
usernames as user(name) instead of ident. Our use of ident in these
places was incorrect as that only refers to the RFC 1413 response
and is not commonly used in the way we used it by any other IRC
server implementations.
Diffstat (limited to 'src/modules/m_spanningtree/nickcollide.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/nickcollide.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/nickcollide.cpp b/src/modules/m_spanningtree/nickcollide.cpp index 97a63e7e3..8ac7f1048 100644 --- a/src/modules/m_spanningtree/nickcollide.cpp +++ b/src/modules/m_spanningtree/nickcollide.cpp @@ -38,7 +38,7 @@ * Sends SAVEs as appropriate and forces nick change of the user 'u' if our side loses or if both lose. * Does not change the nick of the user that is trying to claim the nick of 'u', i.e. the "remote" user. */ -bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteident, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd) +bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remotets, const std::string& remoteuser, const std::string& remoteip, const std::string& remoteuid, const char* collidecmd) { // At this point we're sure that a collision happened, increment the counter regardless of who wins ServerInstance->stats.Collisions++; @@ -68,15 +68,15 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo const time_t localts = u->nickchanged; if (remotets != localts) { - /* first, let's see if ident@host matches. */ - const std::string& localident = u->ident; + /* first, let's see if user@host matches. */ + const std::string& localuser = u->GetRealUser(); const std::string& localip = u->GetAddress(); - bool SamePerson = (localident == remoteident) + bool SamePerson = (localuser == remoteuser) && (localip == remoteip); /* - * if ident@ip is equal, and theirs is newer, or - * ident@ip differ, and ours is newer + * if user@ip is equal, and theirs is newer, or + * user@ip differ, and ours is newer */ if ((SamePerson && remotets < localts) || (!SamePerson && remotets > localts)) { @@ -91,8 +91,8 @@ bool SpanningTreeUtilities::DoCollision(User* u, TreeServer* server, time_t remo } ServerInstance->Logs.Debug(MODNAME, "Nick collision on \"{}\" caused by {}: {}/{}/{}@{} {} <-> {}/{}/{}@{} {}", u->nick, collidecmd, - u->uuid, localts, u->ident, u->GetAddress(), bChangeLocal, - remoteuid, remotets, remoteident, remoteip, bChangeRemote); + u->uuid, localts, u->GetRealUser(), u->GetAddress(), bChangeLocal, + remoteuid, remotets, remoteuser, remoteip, bChangeRemote); /* * Send SAVE and accept the losing client with its UID (as we know the SAVE will |
