|
@@ -2054,7 +2054,7 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
2054
|
2054
|
}
|
2055
|
2055
|
|
2056
|
2056
|
// must pass at least one check, and all enabled checks
|
2057
|
|
- var checkPassed, checkFailed bool
|
|
2057
|
+ var checkPassed, checkFailed, passwordFailed bool
|
2058
|
2058
|
oper := server.GetOperator(msg.Params[0])
|
2059
|
2059
|
if oper != nil {
|
2060
|
2060
|
if oper.Fingerprint != "" {
|
|
@@ -2065,8 +2065,11 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
2065
|
2065
|
}
|
2066
|
2066
|
}
|
2067
|
2067
|
if !checkFailed && oper.Pass != nil {
|
2068
|
|
- if len(msg.Params) == 1 || bcrypt.CompareHashAndPassword(oper.Pass, []byte(msg.Params[1])) != nil {
|
|
2068
|
+ if len(msg.Params) == 1 {
|
2069
|
2069
|
checkFailed = true
|
|
2070
|
+ } else if bcrypt.CompareHashAndPassword(oper.Pass, []byte(msg.Params[1])) != nil {
|
|
2071
|
+ checkFailed = true
|
|
2072
|
+ passwordFailed = true
|
2070
|
2073
|
} else {
|
2071
|
2074
|
checkPassed = true
|
2072
|
2075
|
}
|
|
@@ -2075,11 +2078,18 @@ func operHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
2075
|
2078
|
|
2076
|
2079
|
if !checkPassed || checkFailed {
|
2077
|
2080
|
rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.Nick(), client.t("Password incorrect"))
|
2078
|
|
- client.Quit(client.t("Password incorrect"), rb.session)
|
2079
|
|
- return true
|
|
2081
|
+ // #951: only disconnect them if we actually tried to check a password for them
|
|
2082
|
+ if passwordFailed {
|
|
2083
|
+ client.Quit(client.t("Password incorrect"), rb.session)
|
|
2084
|
+ return true
|
|
2085
|
+ } else {
|
|
2086
|
+ return false
|
|
2087
|
+ }
|
2080
|
2088
|
}
|
2081
|
2089
|
|
2082
|
|
- applyOper(client, oper, rb)
|
|
2090
|
+ if oper != nil {
|
|
2091
|
+ applyOper(client, oper, rb)
|
|
2092
|
+ }
|
2083
|
2093
|
return false
|
2084
|
2094
|
}
|
2085
|
2095
|
|