mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Protect against clients with an empty id.
This commit is contained in:
parent
7f93aa5dc8
commit
8f1bc93cca
1 changed files with 6 additions and 5 deletions
|
@ -609,17 +609,18 @@ func AddClient(group string, c Client, creds ClientCredentials) (*Group, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
id := c.Id()
|
||||||
if g.clients[c.Id()] != nil {
|
if id == "" {
|
||||||
|
return nil, errors.New("client has empty id")
|
||||||
|
}
|
||||||
|
if g.clients[id] != nil {
|
||||||
return nil, ProtocolError("duplicate client id")
|
return nil, ProtocolError("duplicate client id")
|
||||||
}
|
}
|
||||||
|
g.clients[id] = c
|
||||||
g.clients[c.Id()] = c
|
|
||||||
g.timestamp = time.Now()
|
g.timestamp = time.Now()
|
||||||
|
|
||||||
c.Joined(g.Name(), "join")
|
c.Joined(g.Name(), "join")
|
||||||
|
|
||||||
id := c.Id()
|
|
||||||
u := c.Username()
|
u := c.Username()
|
||||||
p := c.Permissions()
|
p := c.Permissions()
|
||||||
s := c.Data()
|
s := c.Data()
|
||||||
|
|
Loading…
Reference in a new issue