From 35b7601b0484f8cf73299932b610bba6bcdde387 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 21 Sep 2001 17:06:12 +0000 Subject: Add an overall timeout on the client authentication cycle, so that a hung client or lost connection can't indefinitely block a postmaster child (not to mention the possibility of deliberate DoS attacks). Timeout is controlled by new authentication_timeout GUC variable, which I set to 60 seconds by default ... does that seem reasonable? --- src/backend/tcop/postgres.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 3aa28e1dbe0..feb8aea129f 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.232 2001/09/08 01:10:20 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.233 2001/09/21 17:06:12 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -967,12 +967,12 @@ die(SIGNAL_ARGS) } /* - * Shutdown signal from postmaster during client authentication. + * Timeout or shutdown signal from postmaster during client authentication. * Simply exit(0). * * XXX: possible future improvement: try to send a message indicating * why we are disconnecting. Problem is to be sure we don't block while - * doing so nor mess up the authentication message exchange. + * doing so, nor mess up the authentication message exchange. */ void authdie(SIGNAL_ARGS) @@ -1168,16 +1168,6 @@ PostgresMain(int argc, char *argv[], SetProcessingMode(InitProcessing); - /* - * If under postmaster, initialize libpq and enable reporting of - * elog errors to the client. - */ - if (IsUnderPostmaster) - { - pq_init(); /* initialize libpq at backend startup */ - whereToSendOutput = Remote; /* now safe to elog to client */ - } - /* * Set default values for command-line options. */ @@ -1736,7 +1726,7 @@ PostgresMain(int argc, char *argv[], if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.232 $ $Date: 2001/09/08 01:10:20 $\n"); + puts("$Revision: 1.233 $ $Date: 2001/09/21 17:06:12 $\n"); } /* -- cgit v1.2.3