aboutsummaryrefslogtreecommitdiff
path: root/src/backend/libpq/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/libpq/auth.c')
-rw-r--r--src/backend/libpq/auth.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 7e328f7bcf6..e0bd078d3e2 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.183 2009/06/25 11:30:08 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.184 2009/08/29 19:26:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,8 +33,10 @@
#include "libpq/ip.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
+#include "miscadmin.h"
#include "storage/ipc.h"
+
/*----------------------------------------------------------------
* Global authentication functions
*----------------------------------------------------------------
@@ -282,6 +284,15 @@ ClientAuthentication(Port *port)
errhint("See server log for details.")));
/*
+ * Enable immediate response to SIGTERM/SIGINT/timeout interrupts.
+ * (We don't want this during hba_getauthmethod() because it might
+ * have to do database access, eg for role membership checks.)
+ */
+ ImmediateInterruptOK = true;
+ /* And don't forget to detect one that already arrived */
+ CHECK_FOR_INTERRUPTS();
+
+ /*
* This is the first point where we have access to the hba record for the
* current connection, so perform any verifications based on the hba
* options field that should be done *before* the authentication here.
@@ -458,6 +469,9 @@ ClientAuthentication(Port *port)
sendAuthRequest(port, AUTH_REQ_OK);
else
auth_failed(port, status);
+
+ /* Done with authentication, so we should turn off immediate interrupts */
+ ImmediateInterruptOK = false;
}
@@ -690,9 +704,6 @@ pg_krb5_recvauth(Port *port)
char *kusername;
char *cp;
- if (get_role_line(port->user_name) == NULL)
- return STATUS_ERROR;
-
ret = pg_krb5_init(port);
if (ret != STATUS_OK)
return ret;
@@ -1823,9 +1834,6 @@ authident(hbaPort *port)
{
char ident_user[IDENT_USERNAME_MAX + 1];
- if (get_role_line(port->user_name) == NULL)
- return STATUS_ERROR;
-
switch (port->raddr.addr.ss_family)
{
case AF_INET: