libpq: Error message improvement
authorPeter Eisentraut <[email protected]>
Tue, 16 May 2023 06:59:34 +0000 (08:59 +0200)
committerPeter Eisentraut <[email protected]>
Tue, 16 May 2023 06:59:34 +0000 (08:59 +0200)
src/interfaces/libpq/fe-auth.c
src/test/authentication/t/001_password.pl
src/test/authentication/t/005_sspi.pl
src/test/kerberos/t/001_auth.pl

index fe2634230a3f1b8df7361fbf1e9cd66165766c22..0dc31988b47f4d196c54eb3061535d228a5fe2e7 100644 (file)
@@ -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;
        }
index 1306fd05d24aa344a410b4a7639071181a350d0f..0680f8b07c5cf1e9a0ba9d330a22bcd068559999 100644 (file)
@@ -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.
index eed0fb125eff12efd3c773b90e5ea7ea1dd9cac0..05d81f342293bcd1bcb936a9648d36964a321385 100644 (file)
@@ -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();
index a5b79a1982ec5e958020a814e4200c7d80a92d23..e2c928349ff9b73da8aa7a941e48fff91421da28 100644 (file)
@@ -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.