From f73b389ceb0c8da2f5210fd2a656dc74b5e437db Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 2 Jul 2020 03:38:20 -0400 Subject: [PATCH 1/3] fix #802 --- irc/server.go | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/irc/server.go b/irc/server.go index 0f0975df..f9b607f4 100644 --- a/irc/server.go +++ b/irc/server.go @@ -41,7 +41,7 @@ var ( // whitelist of caps to serve on the STS-only listener. In particular, // never advertise SASL, to discourage people from sending their passwords: - stsOnlyCaps = caps.NewSet(caps.STS, caps.MessageTags, caps.ServerTime, caps.LabeledResponse, caps.Nope) + stsOnlyCaps = caps.NewSet(caps.STS, caps.MessageTags, caps.ServerTime, caps.Batch, caps.LabeledResponse, caps.EchoMessage, caps.Nope) // we only have standard channels for now. TODO: any updates to this // will also need to be reflected in CasefoldChannel @@ -214,7 +214,7 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) { } if c.isSTSOnly { - server.playRegistrationBurst(session) + server.playSTSBurst(session) return true } @@ -285,6 +285,19 @@ func (server *Server) tryRegister(c *Client, session *Session) (exiting bool) { return false } +func (server *Server) playSTSBurst(session *Session) { + nick := utils.SafeErrorParam(session.client.preregNick) + session.Send(nil, server.name, RPL_WELCOME, nick, fmt.Sprintf("Welcome to the Internet Relay Network %s", nick)) + session.Send(nil, server.name, RPL_YOURHOST, nick, fmt.Sprintf("Your host is %[1]s, running version %[2]s", server.name, "oragono")) + session.Send(nil, server.name, RPL_CREATED, nick, fmt.Sprintf("This server was created %s", time.Time{}.Format(time.RFC1123))) + session.Send(nil, server.name, RPL_MYINFO, nick, server.name, "oragono", "o", "o", "o") + session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii") + session.Send(nil, server.name, ERR_NOMOTD, nick, "MOTD is unavailable") + for _, line := range server.Config().Server.STS.bannerLines { + session.Send(nil, server.name, "NOTICE", nick, line) + } +} + func (server *Server) playRegistrationBurst(session *Session) { c := session.client // continue registration @@ -300,13 +313,6 @@ func (server *Server) playRegistrationBurst(session *Session) { session.Send(nil, server.name, RPL_CREATED, d.nick, fmt.Sprintf(c.t("This server was created %s"), server.ctime.Format(time.RFC1123))) session.Send(nil, server.name, RPL_MYINFO, d.nick, server.name, Ver, rplMyInfo1, rplMyInfo2, rplMyInfo3) - if c.isSTSOnly { - for _, line := range server.Config().Server.STS.bannerLines { - c.Notice(line) - } - return - } - rb := NewResponseBuffer(session) server.RplISupport(c, rb) server.Lusers(c, rb) From dca3965fd3bf597c2e6846e3d42d1f51f5c41080 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 2 Jul 2020 04:00:51 -0400 Subject: [PATCH 2/3] ensure STS-only 005 is a trailing --- irc/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc/server.go b/irc/server.go index f9b607f4..aa3ba3a0 100644 --- a/irc/server.go +++ b/irc/server.go @@ -291,7 +291,7 @@ func (server *Server) playSTSBurst(session *Session) { session.Send(nil, server.name, RPL_YOURHOST, nick, fmt.Sprintf("Your host is %[1]s, running version %[2]s", server.name, "oragono")) session.Send(nil, server.name, RPL_CREATED, nick, fmt.Sprintf("This server was created %s", time.Time{}.Format(time.RFC1123))) session.Send(nil, server.name, RPL_MYINFO, nick, server.name, "oragono", "o", "o", "o") - session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii") + session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii MODES") session.Send(nil, server.name, ERR_NOMOTD, nick, "MOTD is unavailable") for _, line := range server.Config().Server.STS.bannerLines { session.Send(nil, server.name, "NOTICE", nick, line) From ed0d31e28ec3a0afa8975a6fc28322112e31a92d Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 2 Jul 2020 05:13:28 -0400 Subject: [PATCH 3/3] review feedback: fix incorrect sts-only RPL_ISUPPORT --- irc/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc/server.go b/irc/server.go index aa3ba3a0..a4671e23 100644 --- a/irc/server.go +++ b/irc/server.go @@ -291,7 +291,7 @@ func (server *Server) playSTSBurst(session *Session) { session.Send(nil, server.name, RPL_YOURHOST, nick, fmt.Sprintf("Your host is %[1]s, running version %[2]s", server.name, "oragono")) session.Send(nil, server.name, RPL_CREATED, nick, fmt.Sprintf("This server was created %s", time.Time{}.Format(time.RFC1123))) session.Send(nil, server.name, RPL_MYINFO, nick, server.name, "oragono", "o", "o", "o") - session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii MODES") + session.Send(nil, server.name, RPL_ISUPPORT, nick, "CASEMAPPING=ascii", "are supported by this server") session.Send(nil, server.name, ERR_NOMOTD, nick, "MOTD is unavailable") for _, line := range server.Config().Server.STS.bannerLines { session.Send(nil, server.name, "NOTICE", nick, line)