File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1559,9 +1559,8 @@ auth_peer(hbaPort *port)
1559
1559
char ident_user [IDENT_USERNAME_MAX + 1 ];
1560
1560
uid_t uid ;
1561
1561
gid_t gid ;
1562
- struct passwd * pass ;
1562
+ struct passwd * pw ;
1563
1563
1564
- errno = 0 ;
1565
1564
if (getpeereid (port -> sock , & uid , & gid ) != 0 )
1566
1565
{
1567
1566
/* Provide special error message if getpeereid is a stub */
@@ -1576,17 +1575,17 @@ auth_peer(hbaPort *port)
1576
1575
return STATUS_ERROR ;
1577
1576
}
1578
1577
1579
- pass = getpwuid ( uid );
1580
-
1581
- if (pass == NULL )
1578
+ errno = 0 ; /* clear errno before call */
1579
+ pw = getpwuid ( uid );
1580
+ if (! pw )
1582
1581
{
1583
1582
ereport (LOG ,
1584
- (errmsg ("local user with ID %d does not exist " ,
1585
- ( int ) uid )));
1583
+ (errmsg ("failed to look up local user id %ld: %s " ,
1584
+ ( long ) uid , errno ? strerror ( errno ) : _ ( "user does not exist" ) )));
1586
1585
return STATUS_ERROR ;
1587
1586
}
1588
1587
1589
- strlcpy (ident_user , pass -> pw_name , IDENT_USERNAME_MAX + 1 );
1588
+ strlcpy (ident_user , pw -> pw_name , IDENT_USERNAME_MAX + 1 );
1590
1589
1591
1590
return check_usermap (port -> hba -> usermap , port -> user_name , ident_user , false);
1592
1591
}
You can’t perform that action at this time.
0 commit comments