*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.21 2001/08/24 14:07:49 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.22 2001/09/07 16:12:48 wieck Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
#ifdef HAVE_SIGPROCMASK
sigemptyset(&UnBlockSig);
sigfillset(&BlockSig);
+ sigfillset(&AuthBlockSig);
/*
* Unmark those signals that should never be blocked. Some of these
*/
#ifdef SIGTRAP
sigdelset(&BlockSig, SIGTRAP);
+ sigdelset(&AuthBlockSig, SIGTRAP);
#endif
#ifdef SIGABRT
sigdelset(&BlockSig, SIGABRT);
+ sigdelset(&AuthBlockSig, SIGABRT);
#endif
#ifdef SIGILL
sigdelset(&BlockSig, SIGILL);
+ sigdelset(&AuthBlockSig, SIGILL);
#endif
#ifdef SIGFPE
sigdelset(&BlockSig, SIGFPE);
+ sigdelset(&AuthBlockSig, SIGFPE);
#endif
#ifdef SIGSEGV
sigdelset(&BlockSig, SIGSEGV);
+ sigdelset(&AuthBlockSig, SIGSEGV);
#endif
#ifdef SIGBUS
sigdelset(&BlockSig, SIGBUS);
+ sigdelset(&AuthBlockSig, SIGBUS);
#endif
#ifdef SIGSYS
sigdelset(&BlockSig, SIGSYS);
+ sigdelset(&AuthBlockSig, SIGSYS);
#endif
#ifdef SIGCONT
sigdelset(&BlockSig, SIGCONT);
+ sigdelset(&AuthBlockSig, SIGCONT);
+#endif
+#ifdef SIGTERM
+ sigdelset(&AuthBlockSig, SIGTERM);
+#endif
+#ifdef SIGQUIT
+ sigdelset(&AuthBlockSig, SIGQUIT);
#endif
#else
UnBlockSig = 0;
sigmask(SIGINT) | sigmask(SIGUSR1) |
sigmask(SIGUSR2) | sigmask(SIGCHLD) |
sigmask(SIGWINCH) | sigmask(SIGFPE);
+ AuthBlockSig = sigmask(SIGHUP) | sigmask(SIGALRM) |
+ sigmask(SIGINT) | sigmask(SIGUSR1) |
+ sigmask(SIGUSR2) | sigmask(SIGCHLD) |
+ sigmask(SIGWINCH) | sigmask(SIGFPE);
#endif
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.239 2001/09/07 00:46:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.240 2001/09/07 16:12:48 wieck Exp $
*
* NOTES
*
#ifdef HAVE_SIGPROCMASK
sigset_t UnBlockSig,
- BlockSig;
+ BlockSig,
+ AuthBlockSig;
#else
int UnBlockSig,
- BlockSig;
+ BlockSig,
+ AuthBlockSig;
#endif
/*
whereToSendOutput = Remote; /* XXX probably doesn't belong here */
+ /*
+ * We arrange for a simple exit(0) if we receive SIGTERM or SIGQUIT
+ * during any client authentication related communication. Otherwise
+ * the postmaster cannot shutdown the database FAST or IMMED cleanly
+ * if a buggy client blocks a backend during authentication.
+ */
+ pqsignal(SIGTERM, authdie);
+ pqsignal(SIGQUIT, authdie);
+ PG_SETMASK(&AuthBlockSig);
+
/*
* Receive the startup packet (which might turn out to be a cancel
* request packet); then perform client authentication.
ClientAuthentication(MyProcPort); /* might not return, if failure */
+ PG_SETMASK(&BlockSig);
+
/*
* Don't want backend to be able to see the postmaster random number
* generator state. We have to clobber the static random_seed *and*
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.230 2001/08/04 00:14:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.231 2001/09/07 16:12:48 wieck Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
errno = save_errno;
}
+/*
+ * Shutdown signal from postmaster during client authentication.
+ * Simply exit(0).
+ */
+void
+authdie(SIGNAL_ARGS)
+{
+ exit(0);
+}
+
/*
* Query-cancel signal from postmaster: abort current transaction
* at soonest convenient time
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.230 $ $Date: 2001/08/04 00:14:43 $\n");
+ puts("$Revision: 1.231 $ $Date: 2001/09/07 16:12:48 $\n");
}
/*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqsignal.h,v 1.15 2001/01/24 19:43:25 momjian Exp $
+ * $Id: pqsignal.h,v 1.16 2001/09/07 16:12:49 wieck Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
#ifdef HAVE_SIGPROCMASK
extern sigset_t UnBlockSig,
- BlockSig;
+ BlockSig,
+ AuthBlockSig;
#define PG_SETMASK(mask) sigprocmask(SIG_SETMASK, mask, NULL)
#else
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: tcopprot.h,v 1.41 2001/06/08 21:16:48 petere Exp $
+ * $Id: tcopprot.h,v 1.42 2001/09/07 16:12:49 wieck Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
extern void die(SIGNAL_ARGS);
extern void quickdie(SIGNAL_ARGS);
+extern void authdie(SIGNAL_ARGS);
extern int PostgresMain(int argc, char *argv[],
int real_argc, char *real_argv[], const char *username);
extern void ResetUsage(void);