From 91cdb96bcbe5be54954c91d782f34ad9eb29b881 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 27 May 2021 10:51:54 -0400 Subject: [PATCH 1/2] fix HS STATUS help strings --- irc/hostserv.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/irc/hostserv.go b/irc/hostserv.go index d59774c1..77f9c31d 100644 --- a/irc/hostserv.go +++ b/irc/hostserv.go @@ -53,9 +53,9 @@ OFF disables your vhost, if you have one approved.`, handler: hsStatusHandler, help: `Syntax: $bSTATUS [user]$b -STATUS displays your current vhost, if any, and the status of your most recent -request for a new one. A server operator can view someone else's status.`, - helpShort: `$bSTATUS$b shows your vhost and request status.`, +STATUS displays your current vhost, if any, and whether it is enabled or +disabled. A server operator can view someone else's status.`, + helpShort: `$bSTATUS$b shows your vhost status.`, enabled: hostservEnabled, }, "set": { From ec48966b68e6a3bd314532a3e418ba5aa0048a71 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 27 May 2021 11:43:21 -0400 Subject: [PATCH 2/2] fix #1661 If the relay bot and the owner share an IP, legacy bots that identify users by user@host could misinterpret relayed lines as coming from the bot owner. Try to avoid this by using the bot's account cloak where applicable. --- irc/handlers.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/irc/handlers.go b/irc/handlers.go index a418f4ce..7f27519b 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2658,13 +2658,19 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res return false } + details := client.Details() // #1647: we need to publish a full NUH. send ~u (or the configured alternative) // as the user/ident, and send the relayer's hostname as the hostname: ident := config.Server.CoerceIdent if ident == "" { ident = "~u" } - hostname := client.Hostname() + // #1661: if the bot has its own account, use the account cloak, + // otherwise fall back to the hostname (which may be IP-derived) + hostname := details.hostname + if details.accountName != "" { + hostname = config.Server.Cloaks.ComputeAccountCloak(details.accountName) + } nuh := fmt.Sprintf("%s!%s@%s", nick, ident, hostname) channel.AddHistoryItem(history.Item{ @@ -2675,9 +2681,8 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res // 3 possibilities for tags: // no tags, the relaymsg tag only, or the relaymsg tag together with all client-only tags - cnick := client.Nick() relayTag := map[string]string{ - caps.RelaymsgTagName: cnick, + caps.RelaymsgTagName: details.nick, } clientOnlyTags := msg.ClientOnlyTags() var fullTags map[string]string @@ -2685,7 +2690,7 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res fullTags = relayTag } else { fullTags = make(map[string]string, 1+len(clientOnlyTags)) - fullTags[caps.RelaymsgTagName] = cnick + fullTags[caps.RelaymsgTagName] = details.nick for t, v := range clientOnlyTags { fullTags[t] = v }