diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/tcop/backend_startup.c | 23 | ||||
-rw-r--r-- | src/backend/utils/misc/guc_tables.c | 11 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/backend/tcop/backend_startup.c b/src/backend/tcop/backend_startup.c index 0b9f899cd8b..64df3ff32a2 100644 --- a/src/backend/tcop/backend_startup.c +++ b/src/backend/tcop/backend_startup.c @@ -37,6 +37,9 @@ #include "utils/ps_status.h" #include "utils/timeout.h" +/* GUCs */ +bool Trace_connection_negotiation = false; + static void BackendInitialize(ClientSocket *client_sock, CAC_state cac); static int ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done); static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options); @@ -474,6 +477,16 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done) SSLok = 'N'; /* No support for SSL */ #endif + if (Trace_connection_negotiation) + { + if (SSLok == 'S') + ereport(LOG, + (errmsg("SSLRequest accepted"))); + else + ereport(LOG, + (errmsg("SSLRequest rejected"))); + } + retry1: if (send(port->sock, &SSLok, 1, 0) != 1) { @@ -519,6 +532,16 @@ retry1: GSSok = 'G'; #endif + if (Trace_connection_negotiation) + { + if (GSSok == 'G') + ereport(LOG, + (errmsg("GSSENCRequest accepted"))); + else + ereport(LOG, + (errmsg("GSSENCRequest rejected"))); + } + while (send(port->sock, &GSSok, 1, 0) != 1) { if (errno == EINTR) diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index f9bb2b0f9e5..83e3a59d7e9 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -96,6 +96,7 @@ /* XXX these should appear in other modules' header files */ extern bool Log_disconnections; +extern bool Trace_connection_negotiation; extern int CommitDelay; extern int CommitSiblings; extern char *default_tablespace; @@ -1225,6 +1226,16 @@ struct config_bool ConfigureNamesBool[] = NULL, NULL, NULL }, { + {"trace_connection_negotiation", PGC_POSTMASTER, DEVELOPER_OPTIONS, + gettext_noop("Log details of pre-authentication connection handshake."), + NULL, + GUC_NOT_IN_SAMPLE + }, + &Trace_connection_negotiation, + false, + NULL, NULL, NULL + }, + { {"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT, gettext_noop("Logs end of a session, including duration."), NULL |