aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/command.c')
-rw-r--r--agent/command.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/agent/command.c b/agent/command.c
index f2d0389c7..a5baf4d9a 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -843,7 +843,7 @@ static const char hlp_genkey[] =
"\n"
" C: GENKEY\n"
" S: INQUIRE KEYPARAM\n"
- " C: D (genkey (rsa (nbits 2048)))\n"
+ " C: D (genkey (rsa (nbits 3072)))\n"
" C: END\n"
" S: D (public-key\n"
" S: D (rsa (n 326487324683264) (e 10001)))\n"
@@ -3333,7 +3333,7 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
for (;;)
{
- pid_t client_pid;
+ assuan_peercred_t client_creds;
rc = assuan_accept (ctx);
if (gpg_err_code (rc) == GPG_ERR_EOF || rc == -1)
@@ -3346,12 +3346,20 @@ start_command_handler (ctrl_t ctrl, gnupg_fd_t listen_fd, gnupg_fd_t fd)
break;
}
- client_pid = assuan_get_pid (ctx);
- ctrl->server_local->connect_from_self = (client_pid == getpid ());
- if (client_pid != ASSUAN_INVALID_PID)
- ctrl->client_pid = (unsigned long)client_pid;
+ rc = assuan_get_peercred (ctx, &client_creds);
+ if (rc)
+ {
+ log_info ("Assuan get_peercred failed: %s\n", gpg_strerror (rc));
+ client_creds->pid = assuan_get_pid (ctx);
+ ctrl->client_uid = -1;
+ }
+ ctrl->server_local->connect_from_self =
+ (client_creds->pid == getpid ());
+ if (client_creds->pid != ASSUAN_INVALID_PID)
+ ctrl->client_pid = (unsigned long)client_creds->pid;
else
ctrl->client_pid = 0;
+ ctrl->client_uid = client_creds->uid;
rc = assuan_process (ctx);
if (rc)