mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
agent: Fix sending connecting process uid to pinentry.
* agent/command-ssh.c (get_client_info): Use LOCAL_PEERCRED. -- LOCAL_PEERUID was wrong (while there is LOCAL_PEERUUID). For FreeBSD and macOS, we can use LOCAL_PEERCRED to get uid. GnuPG-bug-id: 3757 Fixes-commit: 28aa6890588cc108639951bb4bef03ac17743046 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
c2e69a7a8c
commit
660eafa3a9
@ -3622,7 +3622,15 @@ get_client_info (int fd, struct peer_info_s *out)
|
|||||||
socklen_t len = sizeof (pid_t);
|
socklen_t len = sizeof (pid_t);
|
||||||
|
|
||||||
getsockopt (fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
|
getsockopt (fd, SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
|
||||||
getsockopt (fd, SOL_LOCAL, LOCAL_PEERUID, &client_uid, &len);
|
#if defined (LOCAL_PEERCRED)
|
||||||
|
{
|
||||||
|
struct xucred cr;
|
||||||
|
len = sizeof (struct xucred);
|
||||||
|
|
||||||
|
if (!getsockopt (fd, SOL_LOCAL, LOCAL_PEERCRED, &cr, &len))
|
||||||
|
client_uid = cr.cr_uid;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#elif defined (LOCAL_PEEREID)
|
#elif defined (LOCAL_PEEREID)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user