3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

unregister should boot clients if sasl is required

This commit is contained in:
Shivaram Lingamneni 2019-02-14 14:00:54 -05:00
parent 9ce1d31b90
commit 754934b429
2 changed files with 8 additions and 5 deletions

View File

@ -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,8 +907,14 @@ func (am *AccountManager) Unregister(account string) error {
delete(am.skeletonToAccount, additionalSkel)
}
for _, client := range clients {
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 {
return errAccountDoesNotExist

View File

@ -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()))