mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
libpq: Trace frontend authentication challenges
If tracing was enabled during connection startup, these messages would previously be listed in the trace output as something like this: F 54 Unknown message: 70 mismatched message length: consumed 4, expected 54 With this commit their type and contents are now correctly listed: F 36 StartupMessage 3 0 "user" "foo" "database" "alvherre" F 54 SASLInitialResponse "SCRAM-SHA-256" 32 'n,,n=,r=nq5zEPR/VREHEpOAZzH8Rujm' F 108 SASLResponse 'c=biws,r=nq5zEPR/VREHEpOAZzH8RujmVtWZDQ8glcrvy9OMNw7ZqFUn,p=BBwAKe0WjSvigB6RsmmArAC+hwucLeuwJrR5C/HQD5M=' Author: Jelte Fennema-Nio <postgres@jeltef.nl> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/CAGECzQSoPHtZ4xe0raJ6FYSEiPPS+YWXBhOGo+Y1YecLgknF3g@mail.gmail.com
This commit is contained in:
@@ -331,6 +331,18 @@ typedef enum
|
||||
PGQUERY_CLOSE /* Close Statement or Portal */
|
||||
} PGQueryClass;
|
||||
|
||||
|
||||
/*
|
||||
* valid values for pg_conn->current_auth_response. These are just for
|
||||
* libpq internal use: since authentication response types all use the
|
||||
* protocol byte 'p', fe-trace.c needs a way to distinguish them in order
|
||||
* to print them correctly.
|
||||
*/
|
||||
#define AUTH_RESPONSE_GSS 'G'
|
||||
#define AUTH_RESPONSE_PASSWORD 'P'
|
||||
#define AUTH_RESPONSE_SASL_INITIAL 'I'
|
||||
#define AUTH_RESPONSE_SASL 'S'
|
||||
|
||||
/*
|
||||
* An entry in the pending command queue.
|
||||
*/
|
||||
@@ -490,7 +502,9 @@ struct pg_conn
|
||||
* codes */
|
||||
bool client_finished_auth; /* have we finished our half of the
|
||||
* authentication exchange? */
|
||||
|
||||
char current_auth_response; /* used by pqTraceOutputMessage to
|
||||
* know which auth response we're
|
||||
* sending */
|
||||
|
||||
/* Transient state needed while establishing connection */
|
||||
PGTargetServerType target_server_type; /* desired session properties */
|
||||
|
||||
Reference in New Issue
Block a user