mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Silent GETEVENT command. Requires latest libassuan.
agent/ * command.c (post_cmd_notify, io_monitor): New. (register_commands, start_command_handler): Register them.
This commit is contained in:
parent
a98ea89fa5
commit
a9c688e4d9
@ -1,3 +1,7 @@
|
||||
2006-11-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* configure.ac (HAVE_ASSUAN_SET_IO_MONITOR): Test for it.
|
||||
|
||||
2006-11-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
Released 2.0.0.
|
||||
|
@ -7,6 +7,9 @@
|
||||
* findkey.c (agent_write_private_key): Call bump_key_eventcounter.
|
||||
* trustlist.c (agent_reload_trustlist): Ditto.
|
||||
|
||||
* command.c (post_cmd_notify, io_monitor): New.
|
||||
(register_commands, start_command_handler): Register them.
|
||||
|
||||
2006-11-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg-agent.c (main): In detached mode connect standard
|
||||
|
@ -56,6 +56,7 @@ struct server_local_s
|
||||
int use_cache_for_signing;
|
||||
char *keydesc; /* Allocated description for the next key
|
||||
operation. */
|
||||
int pause_io_logging; /* Used to suppress I/O logging during a command */
|
||||
};
|
||||
|
||||
|
||||
@ -1351,6 +1352,43 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
|
||||
|
||||
|
||||
|
||||
/* Called by libassuan after all commands. ERR is the error from the
|
||||
last assuan operation and not the one returned from the command. */
|
||||
static void
|
||||
post_cmd_notify (assuan_context_t ctx, int err)
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
|
||||
/* Switch off any I/O monitor controlled logging pausing. */
|
||||
ctrl->server_local->pause_io_logging = 0;
|
||||
}
|
||||
|
||||
|
||||
/* This function is called by libassuan for all I/O. We use it here
|
||||
to disable logging for the GETEVENTCOUNTER commands. This is so
|
||||
that the debug output won't get cluttered by this primitive
|
||||
command. */
|
||||
static unsigned int
|
||||
io_monitor (assuan_context_t ctx, int direction,
|
||||
const char *line, size_t linelen)
|
||||
{
|
||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||
|
||||
/* Note that we only check for the uppercase name. This allows to
|
||||
see the logging for debugging if using a non-upercase command
|
||||
name. */
|
||||
if (ctx && !direction
|
||||
&& linelen >= 15
|
||||
&& !strncmp (line, "GETEVENTCOUNTER", 15)
|
||||
&& (linelen == 15 || spacep (line+15)))
|
||||
{
|
||||
ctrl->server_local->pause_io_logging = 1;
|
||||
}
|
||||
|
||||
return ctrl->server_local->pause_io_logging? 1:0;
|
||||
}
|
||||
|
||||
|
||||
/* Tell the assuan library about our commands */
|
||||
static int
|
||||
register_commands (assuan_context_t ctx)
|
||||
@ -1394,6 +1432,9 @@ register_commands (assuan_context_t ctx)
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
#ifdef HAVE_ASSUAN_SET_IO_MONITOR
|
||||
assuan_register_post_cmd_notify (ctx, post_cmd_notify);
|
||||
#endif
|
||||
assuan_register_reset_notify (ctx, reset_notify);
|
||||
assuan_register_option_handler (ctx, option_handler);
|
||||
return 0;
|
||||
@ -1453,6 +1494,10 @@ start_command_handler (int listen_fd, int fd)
|
||||
if (DBG_ASSUAN)
|
||||
assuan_set_log_stream (ctx, log_get_stream ());
|
||||
|
||||
#ifdef HAVE_ASSUAN_SET_IO_MONITOR
|
||||
assuan_set_io_monitor (ctx, io_monitor);
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
{
|
||||
rc = assuan_accept (ctx);
|
||||
|
@ -585,9 +585,13 @@ if test "$have_libassuan" = "yes"; then
|
||||
have_libassuan=no
|
||||
AM_PATH_LIBASSUAN_PTH("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
|
||||
have_libassuan=yes,have_libassuan=no)
|
||||
AM_CHECK_LIBASSUAN("$NEED_LIBASSUAN_API:1.0.1",
|
||||
[AC_DEFINE(HAVE_ASSUAN_SET_IO_MONITOR, 1,
|
||||
[Define to 1 if you have the `assuan_set_io_monitor' function.])],)
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# libksba is our X.509 support library
|
||||
#
|
||||
@ -945,7 +949,7 @@ AC_CHECK_FUNCS([ttyname rand ftello])
|
||||
AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
|
||||
|
||||
#
|
||||
# These are needed by libjnlib - fixme: we should a jnlib.m4
|
||||
# These are needed by libjnlib - fixme: we should use a jnlib.m4
|
||||
#
|
||||
AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol])
|
||||
AC_CHECK_FUNCS([memrchr isascii timegm getrusage setrlimit stat setlocale])
|
||||
|
@ -1,3 +1,7 @@
|
||||
2006-11-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* libassuan.m4: Updated from libassuan SVN.
|
||||
|
||||
2006-10-09 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gnupg-pth.m4: New. Taken from ../acinclude.m4.
|
||||
|
@ -96,6 +96,21 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
|
||||
|
||||
])
|
||||
|
||||
dnl AM_CHECK_LIBASSUAN([MINIMUM-VERSION,
|
||||
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
|
||||
dnl Test whether libassuan has at least MINIMUM-VERSION. This is
|
||||
dnl used to test for features only available in newer versions.
|
||||
dnl
|
||||
AC_DEFUN([AM_CHECK_LIBASSUAN],
|
||||
[ _AM_PATH_LIBASSUAN_COMMON($1)
|
||||
if test $ok = yes; then
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
dnl AM_PATH_LIBASSUAN([MINIMUM-VERSION,
|
||||
@ -120,7 +135,7 @@ AC_DEFUN([AM_PATH_LIBASSUAN],
|
||||
|
||||
dnl AM_PATH_LIBASSUAN_PTH([MINIMUM-VERSION,
|
||||
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
|
||||
dnl Test for libassuan and define LIBASSUAN_PTH_CFLAGSand LIBASSUAN_PTH_LIBS
|
||||
dnl Test for libassuan and define LIBASSUAN_PTH_CFLAGS and LIBASSUAN_PTH_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_LIBASSUAN_PTH],
|
||||
[ _AM_PATH_LIBASSUAN_COMMON($1,pth)
|
||||
@ -144,7 +159,7 @@ dnl Test for libassuan and define LIBASSUAN_PTHREAD_CFLAGS
|
||||
dnl and LIBASSUAN_PTHREAD_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_LIBASSUAN_PTHREAD],
|
||||
[ _AM_PATH_LIBASSUAN_COMMON($1,pth)
|
||||
[ _AM_PATH_LIBASSUAN_COMMON($1,pthread)
|
||||
if test $ok = yes; then
|
||||
LIBASSUAN_PTHREAD_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --cflags`
|
||||
LIBASSUAN_PTHREAD_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --libs`
|
||||
|
Loading…
x
Reference in New Issue
Block a user