3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-15 00:19:29 +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,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: