Skip to content

Commit

Permalink
Avoid forwarding MONITOR requests if upstream doesn't support it
Browse files Browse the repository at this point in the history
Clients aren't supposed to do this, but in case they do, let's
send them an error.
  • Loading branch information
emersion committed Dec 4, 2021
1 parent b2957c0 commit f2a28f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,9 @@ func (dc *downstreamConn) handleMessageRegistered(ctx context.Context, msg *irc.
if uc == nil {
return newUnknownCommandError(msg.Command)
}
if _, ok := uc.isupport["MONITOR"]; !ok {
return newUnknownCommandError(msg.Command)
}

var subcommand string
if err := parseMessageParams(msg, &subcommand); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2075,6 +2075,10 @@ func (uc *upstreamConn) updateChannelAutoDetach(name string) {
}

func (uc *upstreamConn) updateMonitor() {
if _, ok := uc.isupport["MONITOR"]; !ok {
return
}

add := make(map[string]struct{})
var addList []string
seen := make(map[string]struct{})
Expand Down

0 comments on commit f2a28f6

Please sign in to comment.