Changeset 429 in code for trunk


Ignore:
Timestamp:
Nov 24, 2020, 1:22:18 PM (5 years ago)
Author:
hubert
Message:

Prevent downstreams from changing their nick to service's

This commit prevents downstream from sending those commands:

The later is necessary because soju would otherwise save the nick change
and, in the event that the downstream connects in single-upstream mode
to <network>, it will end up with the nickname "BouncerServ".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/downstream.go

    r428 r429  
    10691069                }}
    10701070        case "NICK":
    1071                 var nick string
    1072                 if err := parseMessageParams(msg, &nick); err != nil {
    1073                         return err
    1074                 }
    1075 
     1071                var rawNick string
     1072                if err := parseMessageParams(msg, &rawNick); err != nil {
     1073                        return err
     1074                }
     1075
     1076                nick := rawNick
    10761077                var upstream *upstreamConn
    10771078                if dc.upstream() == nil {
     
    10871088                                Command: irc.ERR_ERRONEUSNICKNAME,
    10881089                                Params:  []string{dc.nick, nick, "contains illegal characters"},
     1090                        }}
     1091                }
     1092                if nick == serviceNick {
     1093                        return ircError{&irc.Message{
     1094                                Command: irc.ERR_NICKNAMEINUSE,
     1095                                Params:  []string{dc.nick, rawNick, "Nickname reserved for bouncer service"},
    10891096                        }}
    10901097                }
Note: See TracChangeset for help on using the changeset viewer.