aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command-ssh.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-10-22 15:24:58 +0000
committerWerner Koch <[email protected]>2018-10-22 15:24:58 +0000
commit68b8096b6617cdad09c99d7eda2035176807e78f (patch)
treea6812e52daeca5ca4830355cc41365cac276228c /agent/command-ssh.c
parentdirmngr: In verbose mode print the OCSP responder id. (diff)
downloadgnupg-68b8096b6617cdad09c99d7eda2035176807e78f.tar.gz
gnupg-68b8096b6617cdad09c99d7eda2035176807e78f.zip
agent: Fix build regression for Windows.
* agent/command-ssh.c (get_client_info): Turn client_uid into an int. Fix setting of it in case of a failed getsocketopt. * agent/command.c (start_command_handler): Fix setting of the pid and uid for Windows. -- Fixes-commit: 28aa6890588cc108639951bb4bef03ac17743046 which obviously was only added to master. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/command-ssh.c')
-rw-r--r--agent/command-ssh.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index df63ed713..ff1f0a5bc 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -3625,7 +3625,7 @@ static void
get_client_info (int fd, struct peer_info_s *out)
{
pid_t client_pid = (pid_t)(-1);
- uid_t client_uid = (uid_t)-1;
+ int client_uid = -1;
#ifdef SO_PEERCRED
{
@@ -3640,10 +3640,10 @@ get_client_info (int fd, struct peer_info_s *out)
{
#if defined (HAVE_STRUCT_SOCKPEERCRED_PID) || defined (HAVE_STRUCT_UCRED_PID)
client_pid = cr.pid;
- client_uid = cr.uid;
+ client_uid = (int)cr.uid;
#elif defined (HAVE_STRUCT_UCRED_CR_PID)
client_pid = cr.cr_pid;
- client_pid = cr.cr_uid;
+ client_uid = (int)cr.cr_uid;
#else
#error "Unknown SO_PEERCRED struct"
#endif
@@ -3660,7 +3660,7 @@ get_client_info (int fd, struct peer_info_s *out)
len = sizeof (struct xucred);
if (!getsockopt (fd, SOL_LOCAL, LOCAL_PEERCRED, &cr, &len))
- client_uid = cr.cr_uid;
+ client_uid = (int)cr.cr_uid;
}
#endif
}
@@ -3670,8 +3670,10 @@ get_client_info (int fd, struct peer_info_s *out)
socklen_t unpl = sizeof unp;
if (getsockopt (fd, 0, LOCAL_PEEREID, &unp, &unpl) != -1)
- client_pid = unp.unp_pid;
- client_uid = unp.unp_euid;
+ {
+ client_pid = unp.unp_pid;
+ client_uid = (int)unp.unp_euid;
+ }
}
#elif defined (HAVE_GETPEERUCRED)
{
@@ -3680,7 +3682,7 @@ get_client_info (int fd, struct peer_info_s *out)
if (getpeerucred (fd, &ucred) != -1)
{
client_pid = ucred_getpid (ucred);
- client_uid = ucred_geteuid (ucred);
+ client_uid = (int)ucred_geteuid (ucred);
ucred_free (ucred);
}
}
@@ -3689,7 +3691,7 @@ get_client_info (int fd, struct peer_info_s *out)
#endif
out->pid = (client_pid == (pid_t)(-1)? 0 : (unsigned long)client_pid);
- out->uid = (int)client_uid;
+ out->uid = client_uid;
}