mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 11:12:44 +01:00
USER: disallow usernames that break the protocol
This commit is contained in:
parent
19c2bb69fc
commit
199f8bd8ae
@ -88,7 +88,6 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) *Client {
|
|||||||
//TODO(dan): replace this with IsUsername/IsIRCName?
|
//TODO(dan): replace this with IsUsername/IsIRCName?
|
||||||
if Name(username).IsNickname() {
|
if Name(username).IsNickname() {
|
||||||
client.Notice("*** Found your username")
|
client.Notice("*** Found your username")
|
||||||
//TODO(dan): we do a bunch of user replacing in server.go userHandler, do we need that here?
|
|
||||||
client.username = Name(username)
|
client.username = Name(username)
|
||||||
// we don't need to updateNickMask here since nickMask is not used for anything yet
|
// we don't need to updateNickMask here since nickMask is not used for anything yet
|
||||||
} else {
|
} else {
|
||||||
|
@ -400,6 +400,13 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// confirm that username is valid
|
||||||
|
//
|
||||||
|
if !Name(msg.Params[0]).IsNickname() {
|
||||||
|
client.Send(nil, "", "ERROR", "Malformed username")
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// set user info and log client in
|
// set user info and log client in
|
||||||
//TODO(dan): Could there be a race condition here with adding/removing the client?
|
//TODO(dan): Could there be a race condition here with adding/removing the client?
|
||||||
//TODO(dan): we should do something like server.clients.Replace(client) instead
|
//TODO(dan): we should do something like server.clients.Replace(client) instead
|
||||||
|
Loading…
Reference in New Issue
Block a user