summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-05-16 08:59:34 +0200
committerPeter Eisentraut <peter@eisentraut.org>2023-05-16 08:59:34 +0200
commitc91f3560835f76bd8c9f614bebaa8c634b98b451 (patch)
treee56e052b9ecf7dcdab3c10daec48ec8599e52e92
parent489b5409e4a0fa36c951561bae8ae4394e7d623f (diff)
downloadpostgresql-c91f3560835f76bd8c9f614bebaa8c634b98b451.tar.gz
libpq: Error message improvement
-rw-r--r--src/interfaces/libpq/fe-auth.c2
-rw-r--r--src/test/authentication/t/001_password.pl36
-rw-r--r--src/test/authentication/t/005_sspi.pl4
-rw-r--r--src/test/kerberos/t/001_auth.pl4
4 files changed, 23 insertions, 23 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index fe2634230a..0dc31988b4 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -909,7 +909,7 @@ check_expected_areq(AuthRequest areq, PGconn *conn)
if (!reason)
reason = auth_method_description(areq);
- libpq_append_conn_error(conn, "auth method \"%s\" requirement failed: %s",
+ libpq_append_conn_error(conn, "authentication method requirement \"%s\" failed: %s",
conn->require_auth, reason);
return result;
}
diff --git a/src/test/authentication/t/001_password.pl b/src/test/authentication/t/001_password.pl
index 1306fd05d2..0680f8b07c 100644
--- a/src/test/authentication/t/001_password.pl
+++ b/src/test/authentication/t/001_password.pl
@@ -168,37 +168,37 @@ $node->connect_fails(
"user=scram_role require_auth=gss",
"GSS authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "gss" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "gss" failed: server did not complete authentication/
);
$node->connect_fails(
"user=scram_role require_auth=sspi",
"SSPI authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "sspi" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "sspi" failed: server did not complete authentication/
);
$node->connect_fails(
"user=scram_role require_auth=password",
"password authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "password" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "password" failed: server did not complete authentication/
);
$node->connect_fails(
"user=scram_role require_auth=md5",
"MD5 authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "md5" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "md5" failed: server did not complete authentication/
);
$node->connect_fails(
"user=scram_role require_auth=scram-sha-256",
"SCRAM authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "scram-sha-256" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "scram-sha-256" failed: server did not complete authentication/
);
$node->connect_fails(
"user=scram_role require_auth=password,scram-sha-256",
"password and SCRAM authentication required, fails with trust auth",
expected_stderr =>
- qr/auth method "password,scram-sha-256" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "password,scram-sha-256" failed: server did not complete authentication/
);
# These negative patterns of require_auth should succeed.
@@ -289,19 +289,19 @@ $node->connect_fails(
"user=scram_role require_auth=md5",
"md5 authentication required, fails with password auth",
expected_stderr =>
- qr/auth method "md5" requirement failed: server requested a cleartext password/
+ qr/authentication method requirement "md5" failed: server requested a cleartext password/
);
$node->connect_fails(
"user=scram_role require_auth=scram-sha-256",
"SCRAM authentication required, fails with password auth",
expected_stderr =>
- qr/auth method "scram-sha-256" requirement failed: server requested a cleartext password/
+ qr/authentication method requirement "scram-sha-256" failed: server requested a cleartext password/
);
$node->connect_fails(
"user=scram_role require_auth=none",
"all authentication forbidden, fails with password auth",
expected_stderr =>
- qr/auth method "none" requirement failed: server requested a cleartext password/
+ qr/authentication method requirement "none" failed: server requested a cleartext password/
);
# Disallowing password authentication fails, even if requested by server.
@@ -313,7 +313,7 @@ $node->connect_fails(
"user=scram_role require_auth=!password,!md5,!scram-sha-256",
"multiple authentication types forbidden, fails with password auth",
expected_stderr =>
- qr/ method "!password,!md5,!scram-sha-256" requirement failed: server requested a cleartext password/
+ qr/ method requirement "!password,!md5,!scram-sha-256" failed: server requested a cleartext password/
);
# For "scram-sha-256" method, user "scram_role" should be able to connect.
@@ -352,19 +352,19 @@ $node->connect_fails(
"user=scram_role require_auth=password",
"password authentication required, fails with SCRAM auth",
expected_stderr =>
- qr/auth method "password" requirement failed: server requested SASL authentication/
+ qr/authentication method requirement "password" failed: server requested SASL authentication/
);
$node->connect_fails(
"user=scram_role require_auth=md5",
"md5 authentication required, fails with SCRAM auth",
expected_stderr =>
- qr/auth method "md5" requirement failed: server requested SASL authentication/
+ qr/authentication method requirement "md5" failed: server requested SASL authentication/
);
$node->connect_fails(
"user=scram_role require_auth=none",
"all authentication forbidden, fails with SCRAM auth",
expected_stderr =>
- qr/auth method "none" requirement failed: server requested SASL authentication/
+ qr/authentication method requirement "none" failed: server requested SASL authentication/
);
# Authentication fails if SCRAM authentication is forbidden.
@@ -407,19 +407,19 @@ $node->connect_fails(
"user=md5_role require_auth=password",
"password authentication required, fails with MD5 auth",
expected_stderr =>
- qr/auth method "password" requirement failed: server requested a hashed password/
+ qr/authentication method requirement "password" failed: server requested a hashed password/
);
$node->connect_fails(
"user=md5_role require_auth=scram-sha-256",
"SCRAM authentication required, fails with MD5 auth",
expected_stderr =>
- qr/auth method "scram-sha-256" requirement failed: server requested a hashed password/
+ qr/authentication method requirement "scram-sha-256" failed: server requested a hashed password/
);
$node->connect_fails(
"user=md5_role require_auth=none",
"all authentication types forbidden, fails with MD5 auth",
expected_stderr =>
- qr/auth method "none" requirement failed: server requested a hashed password/
+ qr/authentication method requirement "none" failed: server requested a hashed password/
);
# Authentication fails if MD5 is forbidden.
@@ -427,13 +427,13 @@ $node->connect_fails(
"user=md5_role require_auth=!md5",
"password authentication forbidden, fails with MD5 auth",
expected_stderr =>
- qr/auth method "!md5" requirement failed: server requested a hashed password/
+ qr/authentication method requirement "!md5" failed: server requested a hashed password/
);
$node->connect_fails(
"user=md5_role require_auth=!password,!md5,!scram-sha-256",
"multiple authentication types forbidden, fails with MD5 auth",
expected_stderr =>
- qr/auth method "!password,!md5,!scram-sha-256" requirement failed: server requested a hashed password/
+ qr/authentication method requirement "!password,!md5,!scram-sha-256" failed: server requested a hashed password/
);
# Test SYSTEM_USER <> NULL with parallel workers.
diff --git a/src/test/authentication/t/005_sspi.pl b/src/test/authentication/t/005_sspi.pl
index eed0fb125e..05d81f3422 100644
--- a/src/test/authentication/t/005_sspi.pl
+++ b/src/test/authentication/t/005_sspi.pl
@@ -29,13 +29,13 @@ $node->connect_fails(
"require_auth=!sspi",
"SSPI authentication forbidden, fails with SSPI auth",
expected_stderr =>
- qr/auth method "!sspi" requirement failed: server requested SSPI authentication/
+ qr/authentication method requirement "!sspi" failed: server requested SSPI authentication/
);
$node->connect_fails(
"require_auth=scram-sha-256",
"SCRAM authentication required, fails with SSPI auth",
expected_stderr =>
- qr/auth method "scram-sha-256" requirement failed: server requested SSPI authentication/
+ qr/authentication method requirement "scram-sha-256" failed: server requested SSPI authentication/
);
done_testing();
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index a5b79a1982..e2c928349f 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -425,14 +425,14 @@ $node->connect_fails(
. " user=test1 host=$host hostaddr=$hostaddr gssencmode=disable require_auth=sspi",
"SSPI authentication requested, fails with non-encrypted GSS",
expected_stderr =>
- qr/auth method "sspi" requirement failed: server requested GSSAPI authentication/
+ qr/authentication method requirement "sspi" failed: server requested GSSAPI authentication/
);
$node->connect_fails(
$node->connstr('postgres')
. " user=test1 host=$host hostaddr=$hostaddr gssencmode=require require_auth=sspi",
"SSPI authentication requested, fails with encrypted GSS",
expected_stderr =>
- qr/auth method "sspi" requirement failed: server did not complete authentication/
+ qr/authentication method requirement "sspi" failed: server did not complete authentication/
);
# Test that SYSTEM_USER works.