1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-08 17:55:59 +01:00

Protect against clients with an empty id.

This commit is contained in:
Juliusz Chroboczek 2023-04-28 16:51:17 +02:00
parent 7f93aa5dc8
commit 8f1bc93cca

View file

@ -609,17 +609,18 @@ func AddClient(group string, c Client, creds ClientCredentials) (*Group, error)
}
}
}
if g.clients[c.Id()] != nil {
id := c.Id()
if id == "" {
return nil, errors.New("client has empty id")
}
if g.clients[id] != nil {
return nil, ProtocolError("duplicate client id")
}
g.clients[c.Id()] = c
g.clients[id] = c
g.timestamp = time.Now()
c.Joined(g.Name(), "join")
id := c.Id()
u := c.Username()
p := c.Permissions()
s := c.Data()