mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-09 21:28:51 +01:00
* call-scd.c (start_scd): Send event-signal option. Always check
that the scdaemon is still running. * gpg-agent.c (handle_signal): Do not use SIGUSR{1,2} anymore for changing the verbosity.
This commit is contained in:
parent
78f797d11d
commit
3d58329f67
@ -1,3 +1,11 @@
|
|||||||
|
2004-04-21 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* call-scd.c (start_scd): Send event-signal option. Always check
|
||||||
|
that the scdaemon is still running.
|
||||||
|
|
||||||
|
* gpg-agent.c (handle_signal): Do not use SIGUSR{1,2} anymore for
|
||||||
|
changing the verbosity.
|
||||||
|
|
||||||
2004-04-16 Werner Koch <wk@gnupg.org>
|
2004-04-16 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* gpg-agent.c (main): Tell the logging code taht we are runnign
|
* gpg-agent.c (main): Tell the logging code taht we are runnign
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
#ifdef USE_GNU_PTH
|
#ifdef USE_GNU_PTH
|
||||||
# include <pth.h>
|
# include <pth.h>
|
||||||
#endif
|
#endif
|
||||||
@ -51,8 +53,8 @@ static ASSUAN_CONTEXT scd_ctx = NULL;
|
|||||||
static pth_mutex_t scd_lock = PTH_MUTEX_INIT;
|
static pth_mutex_t scd_lock = PTH_MUTEX_INIT;
|
||||||
#endif
|
#endif
|
||||||
/* We need to keep track of the connection currently using the SCD.
|
/* We need to keep track of the connection currently using the SCD.
|
||||||
For a pipe server this is all a NOP becuase the connection will
|
For a pipe server this is all a NOP because the connection will
|
||||||
always have the conenction indicator -1. agent_reset_scd releases
|
always have the connection indicator -1. agent_reset_scd releases
|
||||||
the active connection; i.e. sets it back to -1, so that a new
|
the active connection; i.e. sets it back to -1, so that a new
|
||||||
connection can start using the SCD. If we eventually allow
|
connection can start using the SCD. If we eventually allow
|
||||||
multiple SCD session we will either make scdaemon multi-threaded or
|
multiple SCD session we will either make scdaemon multi-threaded or
|
||||||
@ -195,6 +197,8 @@ start_scd (ctrl_t ctrl)
|
|||||||
|
|
||||||
if (scd_ctx)
|
if (scd_ctx)
|
||||||
{
|
{
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
/* If we are not the connection currently using the SCD, return
|
/* If we are not the connection currently using the SCD, return
|
||||||
an error. */
|
an error. */
|
||||||
if (!active_connection)
|
if (!active_connection)
|
||||||
@ -205,8 +209,19 @@ start_scd (ctrl_t ctrl)
|
|||||||
else if (ctrl->connection_fd != active_connection_fd)
|
else if (ctrl->connection_fd != active_connection_fd)
|
||||||
return unlock_scd (gpg_error (GPG_ERR_CONFLICT));
|
return unlock_scd (gpg_error (GPG_ERR_CONFLICT));
|
||||||
|
|
||||||
/* Okay, we scdaemon already started and used by us. */
|
/* Okay, we already started the scdaemon and it is used by us.*/
|
||||||
return 0;
|
|
||||||
|
/* We better do a sanity check now to see whether it has
|
||||||
|
accidently died. */
|
||||||
|
pid = assuan_get_pid (scd_ctx);
|
||||||
|
if (pid != (pid_t)(-1) && pid
|
||||||
|
&& ((rc=waitpid (pid, NULL, WNOHANG))==-1 || (rc == pid)) )
|
||||||
|
{
|
||||||
|
assuan_disconnect (scd_ctx);
|
||||||
|
scd_ctx = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
@ -255,6 +270,14 @@ start_scd (ctrl_t ctrl)
|
|||||||
if (DBG_ASSUAN)
|
if (DBG_ASSUAN)
|
||||||
log_debug ("connection to SCdaemon established\n");
|
log_debug ("connection to SCdaemon established\n");
|
||||||
|
|
||||||
|
/* Tell the scdaemon that we want him to send us an event signal. */
|
||||||
|
{
|
||||||
|
char buf[100];
|
||||||
|
|
||||||
|
sprintf (buf, "OPTION event-signal=%d", SIGUSR2);
|
||||||
|
assuan_transact (scd_ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,15 +1059,11 @@ handle_signal (int signo)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
if (opt.verbose < 5)
|
log_info ("SIGUSR1 received - no action defined\n");
|
||||||
opt.verbose++;
|
|
||||||
log_info ("SIGUSR1 received - verbosity set to %d\n", opt.verbose);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGUSR2:
|
case SIGUSR2:
|
||||||
if (opt.verbose)
|
log_info ("SIGUSR2 received - checking smartcard status\n");
|
||||||
opt.verbose--;
|
|
||||||
log_info ("SIGUSR2 received - verbosity set to %d\n", opt.verbose );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
|
@ -312,15 +312,6 @@ implementation, which calls the scdaemon only once, it is not of much
|
|||||||
use.
|
use.
|
||||||
|
|
||||||
|
|
||||||
@item SIGUSR1
|
|
||||||
@cpindex SIGUSR1
|
|
||||||
This signal increases the verbosity of the logging by one up to a value
|
|
||||||
of 5.
|
|
||||||
|
|
||||||
@item SIGUSR2
|
|
||||||
@cpindex SIGUSR2
|
|
||||||
This signal decreases the verbosity of the logging by one.
|
|
||||||
|
|
||||||
@item SIGTERM
|
@item SIGTERM
|
||||||
@cpindex SIGTERM
|
@cpindex SIGTERM
|
||||||
Shuts down the process but waits until all current requests are
|
Shuts down the process but waits until all current requests are
|
||||||
@ -331,6 +322,13 @@ are still pending, a shutdown is forced.
|
|||||||
@cpindex SIGINT
|
@cpindex SIGINT
|
||||||
Shuts down the process immediately.
|
Shuts down the process immediately.
|
||||||
|
|
||||||
|
|
||||||
|
@item SIGUSR1
|
||||||
|
@itemx SIGUSR2
|
||||||
|
@cpindex SIGUSR1
|
||||||
|
@cpindex SIGUSR2
|
||||||
|
These signals are used for internal purposes.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@c
|
@c
|
||||||
|
Loading…
Reference in New Issue
Block a user