Selaa lähdekoodia

fix #951

tags/v2.1.0-rc1
Shivaram Lingamneni 4 vuotta sitten
vanhempi
commit
bd088ea197
1 muutettua tiedostoa jossa 15 lisäystä ja 5 poistoa
  1. 15
    5
      irc/handlers.go

+ 15
- 5
irc/handlers.go Näytä tiedosto

2054
 	}
2054
 	}
2055
 
2055
 
2056
 	// must pass at least one check, and all enabled checks
2056
 	// must pass at least one check, and all enabled checks
2057
-	var checkPassed, checkFailed bool
2057
+	var checkPassed, checkFailed, passwordFailed bool
2058
 	oper := server.GetOperator(msg.Params[0])
2058
 	oper := server.GetOperator(msg.Params[0])
2059
 	if oper != nil {
2059
 	if oper != nil {
2060
 		if oper.Fingerprint != "" {
2060
 		if oper.Fingerprint != "" {
2065
 			}
2065
 			}
2066
 		}
2066
 		}
2067
 		if !checkFailed && oper.Pass != nil {
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
 				checkFailed = true
2069
 				checkFailed = true
2070
+			} else if bcrypt.CompareHashAndPassword(oper.Pass, []byte(msg.Params[1])) != nil {
2071
+				checkFailed = true
2072
+				passwordFailed = true
2070
 			} else {
2073
 			} else {
2071
 				checkPassed = true
2074
 				checkPassed = true
2072
 			}
2075
 			}
2075
 
2078
 
2076
 	if !checkPassed || checkFailed {
2079
 	if !checkPassed || checkFailed {
2077
 		rb.Add(nil, server.name, ERR_PASSWDMISMATCH, client.Nick(), client.t("Password incorrect"))
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
 	return false
2093
 	return false
2084
 }
2094
 }
2085
 
2095
 

Loading…
Peruuta
Tallenna