File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 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)
15591559 char ident_user [IDENT_USERNAME_MAX + 1 ];
15601560 uid_t uid ;
15611561 gid_t gid ;
1562- struct passwd * pass ;
1562+ struct passwd * pw ;
15631563
1564- errno = 0 ;
15651564 if (getpeereid (port -> sock , & uid , & gid ) != 0 )
15661565 {
15671566 /* Provide special error message if getpeereid is a stub */
@@ -1576,17 +1575,17 @@ auth_peer(hbaPort *port)
15761575 return STATUS_ERROR ;
15771576 }
15781577
1579- pass = getpwuid ( uid );
1580-
1581- if (pass == NULL )
1578+ errno = 0 ; /* clear errno before call */
1579+ pw = getpwuid ( uid );
1580+ if (! pw )
15821581 {
15831582 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" ) )));
15861585 return STATUS_ERROR ;
15871586 }
15881587
1589- strlcpy (ident_user , pass -> pw_name , IDENT_USERNAME_MAX + 1 );
1588+ strlcpy (ident_user , pw -> pw_name , IDENT_USERNAME_MAX + 1 );
15901589
15911590 return check_usermap (port -> hba -> usermap , port -> user_name , ident_user , false);
15921591}
You can’t perform that action at this time.
0 commit comments