#11 fix SASL login failures with non-ASCII passwords
- Normalize SCRAM passwords with RFC 4013 SASLprep before the challenge response, so they match SASLprep-compliant servers (Martin hashes raw UTF-8) and PLAIN still sends the password untouched. - Capture the raw <failure/> condition with LumaSaslFailureModule and map SASL errors to actionable Russian messages instead of the cryptic OS-localized "Martin.SaslError, error 5". - Cover SASLprep and failure message mapping with unit tests and new verify.sh invariants.
This commit is contained in:
1 parent
2884810ec4
commit
fc07855036
13 files changed
+410
-28
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import Martin
|
||||
import XCTest
|
||||
@testable import Luma
|
||||
|
||||
final class SaslFailureMessageTests: XCTestCase {
|
||||
func testNotAuthorizedProducesActionableMessage() {
|
||||
let message = SaslFailureMessage.describe(
|
||||
error: SaslError.not_authorized, condition: nil, serverText: nil)
|
||||
XCTAssertEqual(
|
||||
message,
|
||||
"Сервер отклонил имя пользователя или пароль. Проверьте JID и пароль.")
|
||||
}
|
||||
|
||||
func testServerTextWinsOverCondition() {
|
||||
let message = SaslFailureMessage.describe(
|
||||
error: SaslError.not_authorized,
|
||||
condition: "not-authorized",
|
||||
serverText: "Bad password")
|
||||
XCTAssertEqual(message, "Сервер отклонил вход: Bad password")
|
||||
}
|
||||
|
||||
func testAccountDisabledIsExplained() {
|
||||
let message = SaslFailureMessage.describe(
|
||||
error: SaslError.not_authorized,
|
||||
condition: "account-disabled",
|
||||
serverText: nil)
|
||||
XCTAssertEqual(
|
||||
message,
|
||||
"Аккаунт отключён на сервере. Обратитесь к администратору сервера.")
|
||||
}
|
||||
|
||||
func testCredentialsExpiredIsExplained() {
|
||||
let message = SaslFailureMessage.describe(
|
||||
error: SaslError.not_authorized,
|
||||
condition: "credentials-expired",
|
||||
serverText: nil)
|
||||
XCTAssertEqual(message, "Срок действия пароля истёк. Обновите пароль на сервере.")
|
||||
}
|
||||
|
||||
func testTemporaryAuthFailureIsExplained() {
|
||||
let message = SaslFailureMessage.describe(
|
||||
error: SaslError.temporary_auth_failure, condition: nil, serverText: nil)
|
||||
XCTAssertEqual(
|
||||
message,
|
||||
"Сервер временно не может проверить учётные данные. Попробуйте через минуту.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user