Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite182701

Browse files
committed
Adjust getpwuid() fix commit to display errno string on failure
This adjusts patch613c6d2.
1 parenta87c729 commite182701

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎src/backend/libpq/auth.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,9 +1559,8 @@ auth_peer(hbaPort *port)
15591559
charident_user[IDENT_USERNAME_MAX+1];
15601560
uid_tuid;
15611561
gid_tgid;
1562-
structpasswd*pass;
1562+
structpasswd*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
returnSTATUS_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
returnSTATUS_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
returncheck_usermap(port->hba->usermap,port->user_name,ident_user, false);
15921591
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp