Disallow op with no fingerprint.

This commit is contained in:
Andrey Petrov 2015-01-10 11:31:18 -08:00
parent 12be9c1d1f
commit 6f46645540
2 changed files with 10 additions and 2 deletions

View File

@ -347,8 +347,12 @@ func (c *Client) handleShell(channel ssh.Channel) {
c.SysMsg("No such name: %s", parts[1])
} else {
fingerprint := client.Fingerprint()
client.SysMsg("Made op by %s.", c.ColoredName())
c.Server.Op(fingerprint)
if fingerprint == "" {
c.SysMsg("Cannot op user without fingerprint.")
} else {
client.SysMsg("Made op by %s.", c.ColoredName())
c.Server.Op(fingerprint)
}
}
}
case "/kick":

View File

@ -363,6 +363,10 @@ func (s *Server) Uptime() string {
// IsOp checks if the given client is Op
func (s *Server) IsOp(client *Client) bool {
fingerprint := client.Fingerprint()
if fingerprint == "" {
return false
}
_, r := s.admins[client.Fingerprint()]
return r
}