1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

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?
This commit is contained in:
Tom Lane
2001-09-21 17:06:12 +00:00
parent e3f5bc3492
commit 35b7601b04
8 changed files with 136 additions and 63 deletions

View File

@ -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");
}
/*