Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c91f356

Browse files
committed
libpq: Error message improvement
1 parent 489b540 commit c91f356

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

src/interfaces/libpq/fe-auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ check_expected_areq(AuthRequest areq, PGconn *conn)
909909
if (!reason)
910910
reason = auth_method_description(areq);
911911

912-
libpq_append_conn_error(conn, "auth method \"%s\" requirement failed: %s",
912+
libpq_append_conn_error(conn, "authentication method requirement \"%s\" failed: %s",
913913
conn->require_auth, reason);
914914
return result;
915915
}

src/test/authentication/t/001_password.pl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -168,37 +168,37 @@ sub test_conn
168168
"user=scram_role require_auth=gss",
169169
"GSS authentication required, fails with trust auth",
170170
expected_stderr =>
171-
qr/auth method "gss" requirement failed: server did not complete authentication/
171+
qr/authentication method requirement "gss" failed: server did not complete authentication/
172172
);
173173
$node->connect_fails(
174174
"user=scram_role require_auth=sspi",
175175
"SSPI authentication required, fails with trust auth",
176176
expected_stderr =>
177-
qr/auth method "sspi" requirement failed: server did not complete authentication/
177+
qr/authentication method requirement "sspi" failed: server did not complete authentication/
178178
);
179179
$node->connect_fails(
180180
"user=scram_role require_auth=password",
181181
"password authentication required, fails with trust auth",
182182
expected_stderr =>
183-
qr/auth method "password" requirement failed: server did not complete authentication/
183+
qr/authentication method requirement "password" failed: server did not complete authentication/
184184
);
185185
$node->connect_fails(
186186
"user=scram_role require_auth=md5",
187187
"MD5 authentication required, fails with trust auth",
188188
expected_stderr =>
189-
qr/auth method "md5" requirement failed: server did not complete authentication/
189+
qr/authentication method requirement "md5" failed: server did not complete authentication/
190190
);
191191
$node->connect_fails(
192192
"user=scram_role require_auth=scram-sha-256",
193193
"SCRAM authentication required, fails with trust auth",
194194
expected_stderr =>
195-
qr/auth method "scram-sha-256" requirement failed: server did not complete authentication/
195+
qr/authentication method requirement "scram-sha-256" failed: server did not complete authentication/
196196
);
197197
$node->connect_fails(
198198
"user=scram_role require_auth=password,scram-sha-256",
199199
"password and SCRAM authentication required, fails with trust auth",
200200
expected_stderr =>
201-
qr/auth method "password,scram-sha-256" requirement failed: server did not complete authentication/
201+
qr/authentication method requirement "password,scram-sha-256" failed: server did not complete authentication/
202202
);
203203

204204
# These negative patterns of require_auth should succeed.
@@ -289,19 +289,19 @@ sub test_conn
289289
"user=scram_role require_auth=md5",
290290
"md5 authentication required, fails with password auth",
291291
expected_stderr =>
292-
qr/auth method "md5" requirement failed: server requested a cleartext password/
292+
qr/authentication method requirement "md5" failed: server requested a cleartext password/
293293
);
294294
$node->connect_fails(
295295
"user=scram_role require_auth=scram-sha-256",
296296
"SCRAM authentication required, fails with password auth",
297297
expected_stderr =>
298-
qr/auth method "scram-sha-256" requirement failed: server requested a cleartext password/
298+
qr/authentication method requirement "scram-sha-256" failed: server requested a cleartext password/
299299
);
300300
$node->connect_fails(
301301
"user=scram_role require_auth=none",
302302
"all authentication forbidden, fails with password auth",
303303
expected_stderr =>
304-
qr/auth method "none" requirement failed: server requested a cleartext password/
304+
qr/authentication method requirement "none" failed: server requested a cleartext password/
305305
);
306306

307307
# Disallowing password authentication fails, even if requested by server.
@@ -313,7 +313,7 @@ sub test_conn
313313
"user=scram_role require_auth=!password,!md5,!scram-sha-256",
314314
"multiple authentication types forbidden, fails with password auth",
315315
expected_stderr =>
316-
qr/ method "!password,!md5,!scram-sha-256" requirement failed: server requested a cleartext password/
316+
qr/ method requirement "!password,!md5,!scram-sha-256" failed: server requested a cleartext password/
317317
);
318318

319319
# For "scram-sha-256" method, user "scram_role" should be able to connect.
@@ -352,19 +352,19 @@ sub test_conn
352352
"user=scram_role require_auth=password",
353353
"password authentication required, fails with SCRAM auth",
354354
expected_stderr =>
355-
qr/auth method "password" requirement failed: server requested SASL authentication/
355+
qr/authentication method requirement "password" failed: server requested SASL authentication/
356356
);
357357
$node->connect_fails(
358358
"user=scram_role require_auth=md5",
359359
"md5 authentication required, fails with SCRAM auth",
360360
expected_stderr =>
361-
qr/auth method "md5" requirement failed: server requested SASL authentication/
361+
qr/authentication method requirement "md5" failed: server requested SASL authentication/
362362
);
363363
$node->connect_fails(
364364
"user=scram_role require_auth=none",
365365
"all authentication forbidden, fails with SCRAM auth",
366366
expected_stderr =>
367-
qr/auth method "none" requirement failed: server requested SASL authentication/
367+
qr/authentication method requirement "none" failed: server requested SASL authentication/
368368
);
369369

370370
# Authentication fails if SCRAM authentication is forbidden.
@@ -407,33 +407,33 @@ sub test_conn
407407
"user=md5_role require_auth=password",
408408
"password authentication required, fails with MD5 auth",
409409
expected_stderr =>
410-
qr/auth method "password" requirement failed: server requested a hashed password/
410+
qr/authentication method requirement "password" failed: server requested a hashed password/
411411
);
412412
$node->connect_fails(
413413
"user=md5_role require_auth=scram-sha-256",
414414
"SCRAM authentication required, fails with MD5 auth",
415415
expected_stderr =>
416-
qr/auth method "scram-sha-256" requirement failed: server requested a hashed password/
416+
qr/authentication method requirement "scram-sha-256" failed: server requested a hashed password/
417417
);
418418
$node->connect_fails(
419419
"user=md5_role require_auth=none",
420420
"all authentication types forbidden, fails with MD5 auth",
421421
expected_stderr =>
422-
qr/auth method "none" requirement failed: server requested a hashed password/
422+
qr/authentication method requirement "none" failed: server requested a hashed password/
423423
);
424424

425425
# Authentication fails if MD5 is forbidden.
426426
$node->connect_fails(
427427
"user=md5_role require_auth=!md5",
428428
"password authentication forbidden, fails with MD5 auth",
429429
expected_stderr =>
430-
qr/auth method "!md5" requirement failed: server requested a hashed password/
430+
qr/authentication method requirement "!md5" failed: server requested a hashed password/
431431
);
432432
$node->connect_fails(
433433
"user=md5_role require_auth=!password,!md5,!scram-sha-256",
434434
"multiple authentication types forbidden, fails with MD5 auth",
435435
expected_stderr =>
436-
qr/auth method "!password,!md5,!scram-sha-256" requirement failed: server requested a hashed password/
436+
qr/authentication method requirement "!password,!md5,!scram-sha-256" failed: server requested a hashed password/
437437
);
438438

439439
# Test SYSTEM_USER <> NULL with parallel workers.

src/test/authentication/t/005_sspi.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
"require_auth=!sspi",
3030
"SSPI authentication forbidden, fails with SSPI auth",
3131
expected_stderr =>
32-
qr/auth method "!sspi" requirement failed: server requested SSPI authentication/
32+
qr/authentication method requirement "!sspi" failed: server requested SSPI authentication/
3333
);
3434
$node->connect_fails(
3535
"require_auth=scram-sha-256",
3636
"SCRAM authentication required, fails with SSPI auth",
3737
expected_stderr =>
38-
qr/auth method "scram-sha-256" requirement failed: server requested SSPI authentication/
38+
qr/authentication method requirement "scram-sha-256" failed: server requested SSPI authentication/
3939
);
4040

4141
done_testing();

src/test/kerberos/t/001_auth.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,14 @@ sub test_query
425425
. " user=test1 host=$host hostaddr=$hostaddr gssencmode=disable require_auth=sspi",
426426
"SSPI authentication requested, fails with non-encrypted GSS",
427427
expected_stderr =>
428-
qr/auth method "sspi" requirement failed: server requested GSSAPI authentication/
428+
qr/authentication method requirement "sspi" failed: server requested GSSAPI authentication/
429429
);
430430
$node->connect_fails(
431431
$node->connstr('postgres')
432432
. " user=test1 host=$host hostaddr=$hostaddr gssencmode=require require_auth=sspi",
433433
"SSPI authentication requested, fails with encrypted GSS",
434434
expected_stderr =>
435-
qr/auth method "sspi" requirement failed: server did not complete authentication/
435+
qr/authentication method requirement "sspi" failed: server did not complete authentication/
436436
);
437437

438438
# Test that SYSTEM_USER works.

0 commit comments

Comments
 (0)