Skip to content

Commit 2c97f73

Browse files
committed
Fix bogus order of error checks in new channel_binding code.
Coverity pointed out that it's pretty silly to check for a null pointer after we've already dereferenced the pointer. To fix, just swap the order of the two error checks. Oversight in commit d6e612f.
1 parent 92f1545 commit 2c97f73

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/interfaces/libpq/fe-auth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,18 @@ pg_SASL_init(PGconn *conn, int payloadlen)
502502
selected_mechanism = SCRAM_SHA_256_NAME;
503503
}
504504

505-
if (conn->channel_binding[0] == 'r' && /* require */
506-
strcmp(selected_mechanism, SCRAM_SHA_256_PLUS_NAME) != 0)
505+
if (!selected_mechanism)
507506
{
508507
printfPQExpBuffer(&conn->errorMessage,
509-
libpq_gettext("channel binding is required, but server did not offer an authentication method that supports channel binding\n"));
508+
libpq_gettext("none of the server's SASL authentication mechanisms are supported\n"));
510509
goto error;
511510
}
512511

513-
if (!selected_mechanism)
512+
if (conn->channel_binding[0] == 'r' && /* require */
513+
strcmp(selected_mechanism, SCRAM_SHA_256_PLUS_NAME) != 0)
514514
{
515515
printfPQExpBuffer(&conn->errorMessage,
516-
libpq_gettext("none of the server's SASL authentication mechanisms are supported\n"));
516+
libpq_gettext("channel binding is required, but server did not offer an authentication method that supports channel binding\n"));
517517
goto error;
518518
}
519519

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy