From f87b71b93f348565b8833e4ebe17968eb6b14920 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Fri, 24 Apr 2020 15:39:39 -0400 Subject: [PATCH 1/2] fix #962 --- irc/accounts.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/irc/accounts.go b/irc/accounts.go index 9926c900..68a8b7a6 100644 --- a/irc/accounts.go +++ b/irc/accounts.go @@ -1174,7 +1174,12 @@ func (am *AccountManager) Unregister(account string, erase bool) error { var channelsStr string keepProtections := false am.server.store.Update(func(tx *buntdb.Tx) error { + // get the unfolded account name; for an active account, this is + // stored under accountNameKey, for an unregistered account under unregisteredKey accountName, _ = tx.Get(accountNameKey) + if accountName == "" { + accountName, _ = tx.Get(unregisteredKey) + } if erase { tx.Delete(unregisteredKey) } else { From a7f020320e6a2a7ef135979bc9821e395e033549 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Fri, 24 Apr 2020 15:41:58 -0400 Subject: [PATCH 2/2] make erase confirmation code nondeterministic --- irc/nickserv.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/irc/nickserv.go b/irc/nickserv.go index 4ea051c0..1f52a5df 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -841,6 +841,8 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params if erase { // account may not be in a loadable state, e.g., if it was unregistered accountName = username + // make the confirmation code nondeterministic for ERASE + registeredAt = server.ctime } else { account, err := server.accounts.LoadAccount(username) if err == errAccountDoesNotExist {