From b9296914705f5a2543dbfc44fa08e756765d6fc2 Mon Sep 17 00:00:00 2001 From: William Rehwinkel Date: Thu, 30 Dec 2021 12:15:30 -0500 Subject: [PATCH 1/2] Fix #1883 Nickserv gives error when user attempt to change password to * --- irc/nickserv.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/irc/nickserv.go b/irc/nickserv.go index f450f3fd..acfbb8f6 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -1146,6 +1146,7 @@ func nsConfirmPassword(server *Server, account, passphrase string) (errorMessage func nsPasswdHandler(service *ircService, server *Server, client *Client, command string, params []string, rb *ResponseBuffer) { var target string var newPassword string + var checkPassword string var errorMessage string var oper *Oper @@ -1170,9 +1171,16 @@ func nsPasswdHandler(service *ircService, server *Server, client *Client, comman if newPassword == "*" { newPassword = "" } + + // fix #1883 Nickserv gives error when user attempt to change password to * + checkPassword = params[2] + if checkPassword == "*" { + checkPassword = "" + } + if target == "" { errorMessage = `You're not logged into an account` - } else if newPassword != params[2] { + } else if newPassword != checkPassword { errorMessage = `Passwords do not match` } else { if !nsLoginThrottleCheck(service, client, rb) { From a57bf46e6af49dca2ddf0b4c891f03dbe33b9173 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Thu, 30 Dec 2021 12:59:14 -0500 Subject: [PATCH 2/2] small refactor --- irc/nickserv.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/irc/nickserv.go b/irc/nickserv.go index acfbb8f6..05ea59ee 100644 --- a/irc/nickserv.go +++ b/irc/nickserv.go @@ -1146,7 +1146,6 @@ func nsConfirmPassword(server *Server, account, passphrase string) (errorMessage func nsPasswdHandler(service *ircService, server *Server, client *Client, command string, params []string, rb *ResponseBuffer) { var target string var newPassword string - var checkPassword string var errorMessage string var oper *Oper @@ -1172,10 +1171,9 @@ func nsPasswdHandler(service *ircService, server *Server, client *Client, comman newPassword = "" } - // fix #1883 Nickserv gives error when user attempt to change password to * - checkPassword = params[2] + checkPassword := params[2] if checkPassword == "*" { - checkPassword = "" + checkPassword = "" // #1883 } if target == "" {