3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 08:29:31 +01:00

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.
This commit is contained in:
Shivaram Lingamneni 2021-11-02 17:55:50 -04:00
parent 4ba35afa85
commit 85fabaad6d

View File

@ -541,14 +541,12 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
chname = regInfo.Name chname = regInfo.Name
account := client.Account() account := client.Account()
isFounder := account != "" && account == regInfo.Founder isFounder := account != "" && account == regInfo.Founder
var oper *Oper oper := client.Oper()
if !isFounder { hasPrivs := oper.HasRoleCapab("chanreg")
oper = client.Oper() if !isFounder && !hasPrivs {
if !oper.HasRoleCapab("chanreg") {
service.Notice(rb, client.t("Insufficient privileges")) service.Notice(rb, client.t("Insufficient privileges"))
return return
} }
}
target := params[1] target := params[1]
targetAccount, err := server.accounts.LoadAccount(params[1]) targetAccount, err := server.accounts.LoadAccount(params[1])
if err != nil { if err != nil {
@ -569,7 +567,7 @@ func csTransferHandler(service *ircService, server *Server, client *Client, comm
server.snomasks.Send(sno.LocalOpers, message) server.snomasks.Send(sno.LocalOpers, message)
server.logger.Info("opers", message) server.logger.Info("opers", message)
} }
status, err := channel.Transfer(client, target, oper != nil) status, err := channel.Transfer(client, target, hasPrivs)
if err == nil { if err == nil {
switch status { switch status {
case channelTransferComplete: case channelTransferComplete: