aboutsummaryrefslogtreecommitdiffstats
path: root/common/asshelp.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/asshelp.c')
-rw-r--r--common/asshelp.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/common/asshelp.c b/common/asshelp.c
index b2d13f32b..76518485f 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -27,6 +27,7 @@
#include <locale.h>
#endif
+#define JNLIB_NEED_LOG_LOGV
#include "i18n.h"
#include "util.h"
#include "exechelp.h"
@@ -34,6 +35,36 @@
#include "status.h"
#include "asshelp.h"
+
+static int
+my_libassuan_log_handler (assuan_context_t ctx, void *hook,
+ unsigned int cat, const char *msg)
+{
+ unsigned int dbgval;
+
+ if (cat != ASSUAN_LOG_CONTROL)
+ return 0; /* We only want the control channel messages. */
+ dbgval = hook? *(unsigned int*)hook : 0;
+ if (!(dbgval & 1024))
+ return 0; /* Assuan debugging is not enabled. */
+
+ if (msg)
+ log_string (JNLIB_LOG_DEBUG, msg);
+
+ return 1;
+}
+
+
+/* Setup libassuan to use our own logging functions. Should be used
+ early at startup. */
+void
+setup_libassuan_logging (unsigned int *debug_var_address)
+{
+ assuan_set_log_cb (my_libassuan_log_handler, debug_var_address);
+}
+
+
+
static gpg_error_t
send_one_option (assuan_context_t ctx, gpg_err_source_t errsource,
const char *name, const char *value, int use_putenv)