From 9ce1d31b90de323e162a0e0eedd8d8c067484fdb Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 14 Feb 2019 13:10:35 -0500 Subject: [PATCH 1/2] fix HS STATUS for logged-out users --- irc/hostserv.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc/hostserv.go b/irc/hostserv.go index d66d9c23..696f942d 100644 --- a/irc/hostserv.go +++ b/irc/hostserv.go @@ -206,6 +206,10 @@ func hsStatusHandler(server *Server, client *Client, command string, params []st accountName = params[0] } else { accountName = client.Account() + if accountName == "" { + hsNotice(rb, client.t("You're not logged into an account")) + return + } } account, err := server.accounts.LoadAccount(accountName) From 754934b42958631fa28d30944ee6b91ea7a484f4 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 14 Feb 2019 14:00:54 -0500 Subject: [PATCH 2/2] unregister should boot clients if sasl is required --- irc/accounts.go | 9 ++++++++- irc/nickserv.go | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/irc/accounts.go b/irc/accounts.go index 18bd5ae2..00f76d00 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -834,6 +834,7 @@ func (am *AccountManager) loadRawAccount(tx *buntdb.Tx, casefoldedAccount string } func (am *AccountManager) Unregister(account string) error { + config := am.server.Config() casefoldedAccount, err := CasefoldName(account) if err != nil { return errAccountDoesNotExist @@ -906,7 +907,13 @@ func (am *AccountManager) Unregister(account string) error { delete(am.skeletonToAccount, additionalSkel) } for _, client := range clients { - am.logoutOfAccount(client) + if config.Accounts.RequireSasl.Enabled { + client.Quit(client.t("You are no longer authorized to be on this server")) + // destroy acquires a semaphore so we can't call it while holding a lock + go client.destroy(false) + } else { + am.logoutOfAccount(client) + } } if err != nil { diff --git a/irc/nickserv.go b/irc/nickserv.go index 078ce2f0..4d5368df 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -452,10 +452,6 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params return } - if cfname == client.Account() { - client.server.accounts.Logout(client) - } - err = server.accounts.Unregister(cfname) if err == errAccountDoesNotExist { nsNotice(rb, client.t(err.Error()))