From 85fabaad6d00fa164fb515af8de12d0e73adb5bf Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 2 Nov 2021 17:55:50 -0400 Subject: [PATCH 1/2] fix case where CS TRANSFER as an operator required acceptance Reported by @mogad0n. If a user had both operator privileges and channel owner privileges, the CS TRANSFER would proceed as though unprivileged, requiring acceptance by the receiving user. Fix this to not require acceptance. --- irc/chanserv.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/irc/chanserv.go b/irc/chanserv.go index 35099472..81595f57 100644 --- a/irc/chanserv.go +++ b/irc/chanserv.go @@ -541,13 +541,11 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm chname = regInfo.Name account := client.Account() isFounder := account != "" && account == regInfo.Founder - var oper *Oper - if !isFounder { - oper = client.Oper() - if !oper.HasRoleCapab("chanreg") { - service.Notice(rb, client.t("Insufficient privileges")) - return - } + oper := client.Oper() + hasPrivs := oper.HasRoleCapab("chanreg") + if !isFounder && !hasPrivs { + service.Notice(rb, client.t("Insufficient privileges")) + return } target := params[1] targetAccount, err := server.accounts.LoadAccount(params[1]) @@ -569,7 +567,7 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm server.snomasks.Send(sno.LocalOpers, message) server.logger.Info("opers", message) } - status, err := channel.Transfer(client, target, oper != nil) + status, err := channel.Transfer(client, target, hasPrivs) if err == nil { switch status { case channelTransferComplete: From c4e376c8bb77ebbcd6b26ae63e9469f2b6914c7e Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 2 Nov 2021 17:57:58 -0400 Subject: [PATCH 2/2] fix spurious error logline in schema change --- irc/database.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/irc/database.go b/irc/database.go index bfca9d07..b066a12a 100644 --- a/irc/database.go +++ b/irc/database.go @@ -1080,6 +1080,9 @@ func schemaChangeV21To22(config *Config, tx *buntdb.Tx) error { if !strings.HasPrefix(key, settingsPrefix) { return false } + if value == "" { + return true + } account := strings.TrimPrefix(key, settingsPrefix) if _, err := tx.Get("account.verified " + account); err != nil { return true