Fix bug where scdaemon kills a non-daemon gpg-agent.

This commit is contained in:
Werner Koch 2010-11-11 15:07:37 +00:00
parent 0adca03b8c
commit 2c982dcf86
5 changed files with 25 additions and 8 deletions

3
NEWS
View File

@ -4,6 +4,9 @@ Noteworthy changes in version 2.1.0beta2 (unreleased)
* TMPDIR is now also honored when creating a socket using
--no-standard-socket and with symcryptrun's temp files.
* Fixed a bug where Scdaemon sends a signal to Gpg-agent running in
non-daemon mode.
Noteworthy changes in version 2.1.0beta1 (2010-10-26)
-----------------------------------------------------

View File

@ -1,3 +1,9 @@
2010-11-11 Werner Koch <wk@g10code.com>
* agent.h (opt): Add field SIGUSR2_ENABLED.
* gpg-agent.c (handle_connections): Set that flag.
* call-scd.c (start_scd): Enable events depending on this flag.
2010-10-27 Werner Koch <wk@g10code.com>
* gpg-agent.c (create_socket_name): Use TMPDIR. Change callers.

View File

@ -58,6 +58,9 @@ struct
/* True if we are listening on the standard socket. */
int use_standard_socket;
/* True if we handle sigusr2. */
int sigusr2_enabled;
/* Environment setting gathered at program start or changed using the
Assuan command UPDATESTARTUPTTY. */
session_env_t startup_env;

View File

@ -399,17 +399,18 @@ start_scd (ctrl_t ctrl)
/* Tell the scdaemon we want him to send us an event signal. We
don't support this for W32CE. */
#ifndef HAVE_W32CE_SYSTEM
{
char buf[100];
if (opt.sigusr2_enabled)
{
char buf[100];
#ifdef HAVE_W32_SYSTEM
snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
(unsigned long)get_agent_scd_notify_event ());
snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
(unsigned long)get_agent_scd_notify_event ());
#else
snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
#endif
assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
}
assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
}
#endif /*HAVE_W32CE_SYSTEM*/
primary_scd_ctx = ctx;

View File

@ -1894,6 +1894,10 @@ handle_connections (gnupg_fd_t listen_fd, gnupg_fd_t listen_fd_ssh)
#endif
time_ev = NULL;
/* Set a flag to tell call-scd.c that it may enable event
notifications. */
opt.sigusr2_enabled = 1;
FD_ZERO (&fdset);
FD_SET (FD2INT (listen_fd), &fdset);
nfd = FD2INT (listen_fd);