aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command-ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r--agent/command-ssh.c10
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)
{