diff options
author | NIIBE Yutaka <[email protected]> | 2018-01-26 01:52:56 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-01-26 01:52:56 +0000 |
commit | 660eafa3a9f68e116e9b0597edc317d8ff90f9b2 (patch) | |
tree | e7dbf0fb1c956d4760736e57a89701a1ba8a7b37 /agent/command-ssh.c | |
parent | Merge branch 'STABLE-BRANCH-2-2' into master (diff) | |
download | gnupg-660eafa3a9f68e116e9b0597edc317d8ff90f9b2.tar.gz gnupg-660eafa3a9f68e116e9b0597edc317d8ff90f9b2.zip |
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 <[email protected]>
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r-- | agent/command-ssh.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c index 4ec02ec02..715544635 100644 --- a/agent/command-ssh.c +++ b/agent/command-ssh.c @@ -3622,7 +3622,15 @@ get_client_info (int fd, struct peer_info_s *out) socklen_t len = sizeof (pid_t); 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) { |