[svn] GnuPG - r4339 - in trunk: . agent m4
svn author wk
cvs at cvs.gnupg.org
Tue Nov 14 17:40:45 CET 2006
Author: wk
Date: 2006-11-14 17:40:44 +0100 (Tue, 14 Nov 2006)
New Revision: 4339
Modified:
trunk/ChangeLog
trunk/agent/ChangeLog
trunk/agent/command.c
trunk/configure.ac
trunk/m4/ChangeLog
trunk/m4/libassuan.m4
Log:
Silent GETEVENT command. Requires latest libassuan.
agent/
* command.c (post_cmd_notify, io_monitor): New.
(register_commands, start_command_handler): Register them.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/ChangeLog 2006-11-14 16:40:44 UTC (rev 4339)
@@ -1,3 +1,7 @@
+2006-11-14 Werner Koch <wk at g10code.com>
+
+ * configure.ac (HAVE_ASSUAN_SET_IO_MONITOR): Test for it.
+
2006-11-11 Werner Koch <wk at g10code.com>
Released 2.0.0.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/agent/ChangeLog 2006-11-14 16:40:44 UTC (rev 4339)
@@ -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 at g10code.com>
* gpg-agent.c (main): In detached mode connect standard
Modified: trunk/agent/command.c
===================================================================
--- trunk/agent/command.c 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/agent/command.c 2006-11-14 16:40:44 UTC (rev 4339)
@@ -56,6 +56,7 @@
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 @@
+/* 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 @@
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 @@
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);
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/configure.ac 2006-11-14 16:40:44 UTC (rev 4339)
@@ -585,9 +585,13 @@
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_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])
Modified: trunk/m4/ChangeLog
===================================================================
--- trunk/m4/ChangeLog 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/m4/ChangeLog 2006-11-14 16:40:44 UTC (rev 4339)
@@ -1,3 +1,7 @@
+2006-11-14 Werner Koch <wk at g10code.com>
+
+ * libassuan.m4: Updated from libassuan SVN.
+
2006-10-09 Werner Koch <wk at g10code.com>
* gnupg-pth.m4: New. Taken from ../acinclude.m4.
Modified: trunk/m4/libassuan.m4
===================================================================
--- trunk/m4/libassuan.m4 2006-11-14 14:53:42 UTC (rev 4338)
+++ trunk/m4/libassuan.m4 2006-11-14 16:40:44 UTC (rev 4339)
@@ -96,8 +96,23 @@
])
+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,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libassuan and define LIBASSUAN_CFLAGS and LIBASSUAN_LIBS
@@ -120,7 +135,7 @@
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 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`
More information about the Gnupg-commits
mailing list