libpq: Handle NegotiateProtocolVersion message
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 17 Nov 2022 14:14:44 +0000 (15:14 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 17 Nov 2022 14:42:09 +0000 (15:42 +0100)
commitbbf9c282ce92272ed7bf6771daf0f9efa209e61b
treef05ce44758da3450325dae752d595f623b2f9883
parentdce92e59b1a9ff8401a660a1ac448ea37d498284
libpq: Handle NegotiateProtocolVersion message

Before, receiving a NegotiateProtocolVersion message would result in a
confusing error message like

    expected authentication request from server, but received v

This adds proper handling of this protocol message and produces an
on-topic error message from it.

Reviewed-by: Jacob Champion <jchampion@timescale.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f9c7862f-b864-8ef7-a861-c4638c83e209%40enterprisedb.com
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-protocol3.c
src/interfaces/libpq/libpq-int.h