Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 23671f5

Browse files
committed
Add some more logging to simplify diagnosis of problems in IDENT
authorization. Inspired by problem report from Ian Pilcher.
1 parent b14158f commit 23671f5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/backend/libpq/hba.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.126 2004/07/11 00:18:43 momjian Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.127 2004/07/26 18:53:38 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1222,10 +1222,10 @@ load_ident(void)
12221222
* return false.
12231223
*/
12241224
static bool
1225-
interpret_ident_response(char *ident_response,
1225+
interpret_ident_response(const char *ident_response,
12261226
char *ident_user)
12271227
{
1228-
char *cursor = ident_response; /* Cursor into
1228+
const char *cursor = ident_response; /* Cursor into
12291229
* *ident_response */
12301230

12311231
/*
@@ -1451,6 +1451,10 @@ ident_inet(const SockAddr remote_addr,
14511451

14521452
ident_response[rc] = '\0';
14531453
ident_return = interpret_ident_response(ident_response, ident_user);
1454+
if (!ident_return)
1455+
ereport(LOG,
1456+
(errmsg("invalidly formatted response from Ident server: \"%s\"",
1457+
ident_response)));
14541458

14551459
ident_inet_done:
14561460
if (sock_fd >= 0)
@@ -1648,6 +1652,10 @@ authident(hbaPort *port)
16481652
return STATUS_ERROR;
16491653
}
16501654

1655+
ereport(DEBUG1,
1656+
(errmsg("IDENT code identifies remote user as \"%s\"",
1657+
ident_user)));
1658+
16511659
if (check_ident_usermap(port->auth_arg, port->user_name, ident_user))
16521660
return STATUS_OK;
16531661
else

0 commit comments

Comments
 (0)