Skip to content

Commit ec3a1af

Browse files
author
Neil Conway
committed
Fix a potential backend crash during authentication when parsing a
malformed ident map file. This was introduced by the linked list rewrite in 8.0 -- mea maxima culpa. Per Coverity static analysis performed by EnterpriseDB.
1 parent 09d1110 commit ec3a1af

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

src/backend/libpq/hba.c

Lines changed: 9 additions & 16 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.140 2005/02/26 18:43:33 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.141 2005/06/21 01:20:09 neilc Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1135,16 +1135,16 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
11351135
token = lfirst(line_item);
11361136
file_map = token;
11371137

1138-
/* Get the ident user token (must be provided) */
1138+
/* Get the ident user token */
11391139
line_item = lnext(line_item);
1140-
if (!line)
1140+
if (!line_item)
11411141
goto ident_syntax;
11421142
token = lfirst(line_item);
11431143
file_ident_user = token;
11441144

11451145
/* Get the PG username token */
11461146
line_item = lnext(line_item);
1147-
if (!line)
1147+
if (!line_item)
11481148
goto ident_syntax;
11491149
token = lfirst(line_item);
11501150
file_pguser = token;
@@ -1154,21 +1154,14 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
11541154
strcmp(file_pguser, pg_user) == 0 &&
11551155
strcmp(file_ident_user, ident_user) == 0)
11561156
*found_p = true;
1157+
11571158
return;
11581159

11591160
ident_syntax:
1160-
if (line_item)
1161-
ereport(LOG,
1162-
(errcode(ERRCODE_CONFIG_FILE_ERROR),
1163-
errmsg("invalid entry in file \"%s\" at line %d, token \"%s\"",
1164-
IdentFileName, line_number,
1165-
(const char *) lfirst(line_item))));
1166-
else
1167-
ereport(LOG,
1168-
(errcode(ERRCODE_CONFIG_FILE_ERROR),
1169-
errmsg("missing entry in file \"%s\" at end of line %d",
1170-
IdentFileName, line_number)));
1171-
1161+
ereport(LOG,
1162+
(errcode(ERRCODE_CONFIG_FILE_ERROR),
1163+
errmsg("missing entry in file \"%s\" at end of line %d",
1164+
IdentFileName, line_number)));
11721165
*error_p = true;
11731166
}
11741167

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy