Add some more logging to simplify diagnosis of problems in IDENT

authorization.  Inspired by problem report from Ian Pilcher.
This commit is contained in:
Tom Lane 2004-07-26 18:53:38 +00:00
parent b14158f405
commit 23671f5a0e

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.126 2004/07/11 00:18:43 momjian Exp $ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.127 2004/07/26 18:53:38 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -1222,10 +1222,10 @@ load_ident(void)
* return false. * return false.
*/ */
static bool static bool
interpret_ident_response(char *ident_response, interpret_ident_response(const char *ident_response,
char *ident_user) char *ident_user)
{ {
char *cursor = ident_response; /* Cursor into const char *cursor = ident_response; /* Cursor into
* *ident_response */ * *ident_response */
/* /*
@ -1451,6 +1451,10 @@ ident_inet(const SockAddr remote_addr,
ident_response[rc] = '\0'; ident_response[rc] = '\0';
ident_return = interpret_ident_response(ident_response, ident_user); ident_return = interpret_ident_response(ident_response, ident_user);
if (!ident_return)
ereport(LOG,
(errmsg("invalidly formatted response from Ident server: \"%s\"",
ident_response)));
ident_inet_done: ident_inet_done:
if (sock_fd >= 0) if (sock_fd >= 0)
@ -1648,6 +1652,10 @@ authident(hbaPort *port)
return STATUS_ERROR; return STATUS_ERROR;
} }
ereport(DEBUG1,
(errmsg("IDENT code identifies remote user as \"%s\"",
ident_user)));
if (check_ident_usermap(port->auth_arg, port->user_name, ident_user)) if (check_ident_usermap(port->auth_arg, port->user_name, ident_user))
return STATUS_OK; return STATUS_OK;
else else