aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command-ssh.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2022-04-04 07:39:27 +0000
committerNIIBE Yutaka <[email protected]>2022-04-04 07:39:27 +0000
commit48ee11722dd060dacac55ae56ee699c0f5271bda (patch)
tree720c15dd57e9181a24e363fa8fec6b69508b463d /agent/command-ssh.c
parentscd,tpm2d: Fix for consistent use of socket FD. (diff)
downloadgnupg-48ee11722dd060dacac55ae56ee699c0f5271bda.tar.gz
gnupg-48ee11722dd060dacac55ae56ee699c0f5271bda.zip
agent:w32: Fix for use of socket.
* agent/command-ssh.c (get_client_info): Use type gnupg_fd_t for socket, until call of socket API. (start_command_handler_ssh): Don't convert here. -- Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r--agent/command-ssh.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 426b11e67..f8b00c688 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3590,7 +3590,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
/* Return the peer's pid. */
static void
-get_client_info (int fd, struct peer_info_s *out)
+get_client_info (gnupg_fd_t fd, struct peer_info_s *out)
{
pid_t client_pid = (pid_t)(-1);
int client_uid = -1;
@@ -3604,7 +3604,7 @@ get_client_info (int fd, struct peer_info_s *out)
#endif
socklen_t cl = sizeof cr;
- if (!getsockopt (fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl))
+ if (!getsockopt (FD2INT (fd), SOL_SOCKET, SO_PEERCRED, &cr, &cl))
{
#if defined (HAVE_STRUCT_SOCKPEERCRED_PID) || defined (HAVE_STRUCT_UCRED_PID)
client_pid = cr.pid;
@@ -3621,13 +3621,13 @@ 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 (FD2INT (fd), SOL_LOCAL, LOCAL_PEERPID, &client_pid, &len);
#if defined (LOCAL_PEERCRED)
{
struct xucred cr;
len = sizeof (struct xucred);
- if (!getsockopt (fd, SOL_LOCAL, LOCAL_PEERCRED, &cr, &len))
+ if (!getsockopt (FD2INT (fd), SOL_LOCAL, LOCAL_PEERCRED, &cr, &len))
client_uid = (int)cr.cr_uid;
}
#endif
@@ -3637,7 +3637,7 @@ get_client_info (int fd, struct peer_info_s *out)
struct unpcbid unp;
socklen_t unpl = sizeof unp;
- if (getsockopt (fd, 0, LOCAL_PEEREID, &unp, &unpl) != -1)
+ if (getsockopt (FD2INT (fd), 0, LOCAL_PEEREID, &unp, &unpl) != -1)
{
client_pid = unp.unp_pid;
client_uid = (int)unp.unp_euid;
@@ -3647,7 +3647,7 @@ get_client_info (int fd, struct peer_info_s *out)
{
ucred_t *ucred = NULL;
- if (getpeerucred (fd, &ucred) != -1)
+ if (getpeerucred (FD2INT (fd), &ucred) != -1)
{
client_pid = ucred_getpid (ucred);
client_uid = (int)ucred_geteuid (ucred);
@@ -3676,7 +3676,7 @@ start_command_handler_ssh (ctrl_t ctrl, gnupg_fd_t sock_client)
if (err)
goto out;
- get_client_info (FD2INT(sock_client), &peer_info);
+ get_client_info (sock_client, &peer_info);
ctrl->client_pid = peer_info.pid;
ctrl->client_uid = peer_info.uid;