From 363b120cc5c87a15567633b644fcb2cbf4def20b Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 9 Apr 2018 12:29:19 -0400 Subject: [PATCH] fix #227 --- irc/nickserv.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/irc/nickserv.go b/irc/nickserv.go index 226866f2..77e22ab6 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -193,12 +193,6 @@ func nsDropHandler(server *Server, client *Client, command, params string, rb *R func nsGhostHandler(server *Server, client *Client, command, params string, rb *ResponseBuffer) { nick, _ := utils.ExtractParam(params) - account := client.Account() - if account == "" || server.accounts.NickToAccount(nick) != account { - nsNotice(rb, client.t("You don't own that nick")) - return - } - ghost := server.clients.Get(nick) if ghost == nil { nsNotice(rb, client.t("No such nick")) @@ -208,6 +202,17 @@ func nsGhostHandler(server *Server, client *Client, command, params string, rb * return } + authorized := false + account := client.Account() + if account != "" { + // the user must either own the nick, or the target client + authorized = (server.accounts.NickToAccount(nick) == account) || (ghost.Account() == account) + } + if !authorized { + nsNotice(rb, client.t("You don't own that nick")) + return + } + ghost.Quit(fmt.Sprintf(ghost.t("GHOSTed by %s"), client.Nick())) ghost.destroy(false) }