Disallow op with no fingerprint.

This commit is contained in:
Andrey Petrov committed 2015-01-10 11:31:18 -08:00
1 parent 12be9c1d1f
commit 6f46645540
2 files changed
+10 -2

No files matched your search

+6 -2
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":
+4
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
}