summaryrefslogtreecommitdiff
path: root/src/backend/libpq/pqsignal.c
diff options
context:
space:
mode:
authorTom Lane2001-09-21 17:06:12 +0000
committerTom Lane2001-09-21 17:06:12 +0000
commit35b7601b0484f8cf73299932b610bba6bcdde387 (patch)
treebe929f72b1fa13a689ce36d7afcddd777375c44e /src/backend/libpq/pqsignal.c
parente3f5bc3492efa1fa6d20491bb3134c9b32f30b7d (diff)
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?
Diffstat (limited to 'src/backend/libpq/pqsignal.c')
-rw-r--r--src/backend/libpq/pqsignal.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/libpq/pqsignal.c b/src/backend/libpq/pqsignal.c
index effe2e09cfc..d8c7a1d852c 100644
--- a/src/backend/libpq/pqsignal.c
+++ b/src/backend/libpq/pqsignal.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.23 2001/09/08 01:10:20 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.24 2001/09/21 17:06:12 tgl Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
@@ -53,7 +53,7 @@
* signals that should never be turned off.
*
* AuthBlockSig is the set of signals to block during authentication;
- * it's essentially BlockSig minus SIGTERM and SIGQUIT.
+ * it's essentially BlockSig minus SIGTERM, SIGQUIT, SIGALRM.
*
* UnBlockSig is the set of signals to block when we don't want to block
* signals (is this ever nonzero??)
@@ -109,6 +109,9 @@ pqinitmask(void)
#ifdef SIGQUIT
sigdelset(&AuthBlockSig, SIGQUIT);
#endif
+#ifdef SIGALRM
+ sigdelset(&AuthBlockSig, SIGALRM);
+#endif
#else
UnBlockSig = 0;
BlockSig = sigmask(SIGHUP) | sigmask(SIGQUIT) |
@@ -116,7 +119,7 @@ pqinitmask(void)
sigmask(SIGINT) | sigmask(SIGUSR1) |
sigmask(SIGUSR2) | sigmask(SIGCHLD) |
sigmask(SIGWINCH) | sigmask(SIGFPE);
- AuthBlockSig = sigmask(SIGHUP) | sigmask(SIGALRM) |
+ AuthBlockSig = sigmask(SIGHUP) |
sigmask(SIGINT) | sigmask(SIGUSR1) |
sigmask(SIGUSR2) | sigmask(SIGCHLD) |
sigmask(SIGWINCH) | sigmask(SIGFPE);