aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-auth.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-05-05 11:24:02 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2017-05-05 11:24:02 +0300
commitbd05ad8b052012155fd5de0c21029d5869ad5eb4 (patch)
treece7da619dd716625982b9b4318f865a22ebfdf58 /src/interfaces/libpq/fe-auth.c
parent071d13395cc2ea0b87aa5f135c87808d6dd60cd5 (diff)
downloadpostgresql-bd05ad8b052012155fd5de0c21029d5869ad5eb4.tar.gz
postgresql-bd05ad8b052012155fd5de0c21029d5869ad5eb4.zip
Give nicer error message when connecting to a v10 server requiring SCRAM.
This is just to give the user a hint that they need to upgrade, if they try to connect to a v10 server that uses SCRAM authentication, with an older client. Commit to all stable branches, but not master. Discussion: https://www.postgresql.org/message-id/bbf45d92-3896-eeb7-7399-2111d517261b@pivotal.io
Diffstat (limited to 'src/interfaces/libpq/fe-auth.c')
-rw-r--r--src/interfaces/libpq/fe-auth.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 9bf6e52d631..493ef82d4a7 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -703,6 +703,19 @@ pg_fe_sendauth(AuthRequest areq, PGconn *conn)
return STATUS_ERROR;
break;
+ /*
+ * SASL authentication was introduced in version 10. Older
+ * versions recognize the request only to give a nicer error
+ * message. We call it "SCRAM authentication" in the error, rather
+ * than SASL, because SCRAM is more familiar to users, and it's
+ * the only SASL authentication mechanism that has been
+ * implemented as of this writing, anyway.
+ */
+ case AUTH_REQ_SASL:
+ printfPQExpBuffer(&conn->errorMessage,
+ libpq_gettext("SCRAM authentication requires libpq version 10 or above\n"));
+ return STATUS_ERROR;
+
default:
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("authentication method %u not supported\n"), areq);