mirror of
https://github.com/postgres/postgres.git
synced 2026-05-27 20:27:28 -04:00
Simplify signature of ProcessStartupPacket()
There is now only one caller of ProcessStartupPacket(). Let's simplify the routine so as the GSS and SSL states are tracked inside it. If future callers are added, there is less guessing to do. Suggested-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://postgr.es/m/aga7lCWluyc5zLb5@paquier.xyz
This commit is contained in:
parent
4111b91ab3
commit
3dcd85d1b9
1 changed files with 16 additions and 9 deletions
|
|
@ -59,7 +59,7 @@ ConnectionTiming conn_timing = {.ready_for_use = TIMESTAMP_MINUS_INFINITY};
|
|||
|
||||
static void BackendInitialize(ClientSocket *client_sock, CAC_state cac);
|
||||
static int ProcessSSLStartup(Port *port);
|
||||
static int ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done);
|
||||
static int ProcessStartupPacket(Port *port);
|
||||
static void ProcessCancelRequestPacket(Port *port, void *pkt, int pktlen);
|
||||
static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options);
|
||||
static void process_startup_packet_die(SIGNAL_ARGS);
|
||||
|
|
@ -292,7 +292,7 @@ BackendInitialize(ClientSocket *client_sock, CAC_state cac)
|
|||
* packet).
|
||||
*/
|
||||
if (status == STATUS_OK)
|
||||
status = ProcessStartupPacket(port, false, false);
|
||||
status = ProcessStartupPacket(port);
|
||||
|
||||
/*
|
||||
* If we're going to reject the connection due to database state, say so
|
||||
|
|
@ -481,20 +481,27 @@ reject:
|
|||
* send anything to the client, which would typically be appropriate
|
||||
* if we detect a communications failure.)
|
||||
*
|
||||
* Set ssl_done and/or gss_done when negotiation of an encrypted layer
|
||||
* (currently, TLS or GSSAPI) is completed. A successful negotiation of either
|
||||
* encryption layer sets both flags, but a rejected negotiation sets only the
|
||||
* flag for that layer, since the client may wish to try the other one. We
|
||||
* should make no assumption here about the order in which the client may make
|
||||
* requests.
|
||||
*/
|
||||
static int
|
||||
ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done)
|
||||
ProcessStartupPacket(Port *port)
|
||||
{
|
||||
int32 len;
|
||||
char *buf = NULL;
|
||||
ProtocolVersion proto;
|
||||
MemoryContext oldcontext;
|
||||
bool gss_done;
|
||||
bool ssl_done;
|
||||
|
||||
/*
|
||||
* Set ssl_done and/or gss_done when negotiation of an encrypted layer
|
||||
* (currently, TLS or GSSAPI) is completed. A successful negotiation of
|
||||
* either encryption layer sets both flags, but a rejected negotiation
|
||||
* sets only the flag for that layer, since the client may wish to try the
|
||||
* other one. We should make no assumption here about the order in which
|
||||
* the client may make requests.
|
||||
*/
|
||||
gss_done = false;
|
||||
ssl_done = false;
|
||||
|
||||
retry:
|
||||
pq_startmsgread();
|
||||
|
|
|
|||
Loading…
Reference in a new issue