Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e1827012
Commit
e1827012
authored
Mar 28, 2014
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust getpwuid() fix commit to display errno string on failure
This adjusts patch
613c6d26
.
parent
a87c7291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
src/backend/libpq/auth.c
src/backend/libpq/auth.c
+7
-8
No files found.
src/backend/libpq/auth.c
View file @
e1827012
...
@@ -1559,9 +1559,8 @@ auth_peer(hbaPort *port)
...
@@ -1559,9 +1559,8 @@ auth_peer(hbaPort *port)
char
ident_user
[
IDENT_USERNAME_MAX
+
1
];
char
ident_user
[
IDENT_USERNAME_MAX
+
1
];
uid_t
uid
;
uid_t
uid
;
gid_t
gid
;
gid_t
gid
;
struct
passwd
*
p
ass
;
struct
passwd
*
p
w
;
errno
=
0
;
if
(
getpeereid
(
port
->
sock
,
&
uid
,
&
gid
)
!=
0
)
if
(
getpeereid
(
port
->
sock
,
&
uid
,
&
gid
)
!=
0
)
{
{
/* Provide special error message if getpeereid is a stub */
/* Provide special error message if getpeereid is a stub */
...
@@ -1576,17 +1575,17 @@ auth_peer(hbaPort *port)
...
@@ -1576,17 +1575,17 @@ auth_peer(hbaPort *port)
return
STATUS_ERROR
;
return
STATUS_ERROR
;
}
}
pass
=
getpwuid
(
uid
);
errno
=
0
;
/* clear errno before call */
pw
=
getpwuid
(
uid
);
if
(
pass
==
NULL
)
if
(
!
pw
)
{
{
ereport
(
LOG
,
ereport
(
LOG
,
(
errmsg
(
"
local user with ID %d does not exist
"
,
(
errmsg
(
"
failed to look up local user id %ld: %s
"
,
(
int
)
uid
)));
(
long
)
uid
,
errno
?
strerror
(
errno
)
:
_
(
"user does not exist"
)
)));
return
STATUS_ERROR
;
return
STATUS_ERROR
;
}
}
strlcpy
(
ident_user
,
p
ass
->
pw_name
,
IDENT_USERNAME_MAX
+
1
);
strlcpy
(
ident_user
,
p
w
->
pw_name
,
IDENT_USERNAME_MAX
+
1
);
return
check_usermap
(
port
->
hba
->
usermap
,
port
->
user_name
,
ident_user
,
false
);
return
check_usermap
(
port
->
hba
->
usermap
,
port
->
user_name
,
ident_user
,
false
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment