[git] GnuPG - branch, master, updated. gnupg-2.2.7-229-g68b8096

by Werner Koch cvs at cvs.gnupg.org
Mon Oct 22 17:27:55 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  68b8096b6617cdad09c99d7eda2035176807e78f (commit)
      from  0a7f446c189201ca6e527af08b44da756b343209 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 68b8096b6617cdad09c99d7eda2035176807e78f
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Oct 22 17:24:58 2018 +0200

    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 <wk at gnupg.org>

diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index df63ed7..ff1f0a5 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;
 }
 
 
diff --git a/agent/command.c b/agent/command.c
index 925d1f7..0871753 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -3588,8 +3588,13 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
         }
       else
         {
+#ifdef HAVE_W32_SYSTEM
+          pid = assuan_get_pid (ctx);
+          ctrl->client_uid = -1;
+#else
           pid = client_creds->pid;
           ctrl->client_uid = client_creds->uid;
+#endif
         }
       ctrl->client_pid = (pid == ASSUAN_INVALID_PID)? 0 : (unsigned long)pid;
       ctrl->server_local->connect_from_self = (pid == getpid ());

-----------------------------------------------------------------------

Summary of changes:
 agent/command-ssh.c | 18 ++++++++++--------
 agent/command.c     |  5 +++++
 2 files changed, 15 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list