From 6f466455401fe117eb5151474a2bfba0ad6402f2 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Sat, 10 Jan 2015 11:31:18 -0800 Subject: [PATCH] Disallow op with no fingerprint. --- client.go | 8 ++++++-- server.go | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index d29b5b6..781b4d8 100644 --- a/client.go +++ b/client.go @@ -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": diff --git a/server.go b/server.go index 9022f38..c5f4127 100644 --- a/server.go +++ b/server.go @@ -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 }