mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
fix #951
This commit is contained in:
parent
360a5af90d
commit
bd088ea197
@ -2054,7 +2054,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// must pass at least one check, and all enabled checks
|
// must pass at least one check, and all enabled checks
|
||||||
var checkPassed, checkFailed bool
|
var checkPassed, checkFailed, passwordFailed bool
|
||||||
oper := server.GetOperator(msg.Params[0])
|
oper := server.GetOperator(msg.Params[0])
|
||||||
if oper != nil {
|
if oper != nil {
|
||||||
if oper.Fingerprint != "" {
|
if oper.Fingerprint != "" {
|
||||||
@ -2065,8 +2065,11 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !checkFailed && oper.Pass != nil {
|
if !checkFailed && oper.Pass != nil {
|
||||||
if len(msg.Params) == 1 || bcrypt.CompareHashAndPassword(oper.Pass, []byte(msg.Params[1])) != nil {
|
if len(msg.Params) == 1 {
|
||||||
checkFailed = true
|
checkFailed = true
|
||||||
|
} else if bcrypt.CompareHashAndPassword(oper.Pass, []byte(msg.Params[1])) != nil {
|
||||||
|
checkFailed = true
|
||||||
|
passwordFailed = true
|
||||||
} else {
|
} else {
|
||||||
checkPassed = true
|
checkPassed = true
|
||||||
}
|
}
|
||||||
@ -2075,11 +2078,18 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
|
|
||||||
if !checkPassed || checkFailed {
|
if !checkPassed || checkFailed {
|
||||||
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.Nick(), client.t("Password incorrect"))
|
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.Nick(), client.t("Password incorrect"))
|
||||||
|
// #951: only disconnect them if we actually tried to check a password for them
|
||||||
|
if passwordFailed {
|
||||||
client.Quit(client.t("Password incorrect"), rb.session)
|
client.Quit(client.t("Password incorrect"), rb.session)
|
||||||
return true
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if oper != nil {
|
||||||
applyOper(client, oper, rb)
|
applyOper(client, oper, rb)
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user