[evolution-patches] debug patch for gpg output
- From: Not Zed <notzed ximian com>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] debug patch for gpg output
- Date: Fri, 16 Jul 2004 14:09:16 +0000
This adds some stuff to help debug gpg problems and to make some other spew optional.
Developed it for the never-ending 53355 bug, but i thought it would be useful to have in the main codebase anyway.
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2216
diff -u -3 -r1.2216 ChangeLog
--- camel/ChangeLog 13 Jul 2004 07:35:52 -0000 1.2216
+++ camel/ChangeLog 16 Jul 2004 14:06:36 -0000
@@ -1,3 +1,7 @@
+2004-07-16 Not Zed <NotZed Ximian com>
+
+ * camel-gpg-context.c: Added some debug stuff.
+
2004-07-12 Sivaiah Nallagatla <snallagatla novell com>
* providers/groupwise/camel-gw-listener.c : (add_esource)
Index: camel/camel-gpg-context.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-gpg-context.c,v
retrieving revision 1.61
diff -u -3 -r1.61 camel-gpg-context.c
--- camel/camel-gpg-context.c 13 Jul 2004 04:05:10 -0000 1.61
+++ camel/camel-gpg-context.c 16 Jul 2004 14:06:37 -0000
@@ -20,6 +20,11 @@
*
*/
+/* Debug states:
+ gpg:sign dump canonicalised to-be-signed data to a file
+ gpg:verify dump canonicalised verification and signature data to file
+ gpg:status print gpg status-fd output to stdout
+*/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -57,6 +62,13 @@
#define d(x)
+#define GPG_LOG
+
+#ifdef GPG_LOG
+#include "camel-debug.h"
+static int logid;
+#endif
+
static CamelCipherContextClass *parent_class = NULL;
/**
@@ -714,8 +726,9 @@
*inptr++ = '\0';
status = gpg->statusbuf;
-
- printf ("status: %s\n", status);
+
+ if (camel_debug("gpg:status"))
+ printf ("status: %s\n", status);
if (strncmp (status, "[GNUPG:] ", 9) != 0) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -1263,6 +1276,24 @@
goto fail;
}
+#ifdef GPG_LOG
+ if (camel_debug_start("gpg:sign")) {
+ char *name;
+ CamelStream *out;
+
+ name = g_strdup_printf("camel-gpg.%d.sign-data", logid++);
+ out = camel_stream_fs_new_with_name(name, O_CREAT|O_TRUNC|O_WRONLY, 0666);
+ if (out) {
+ printf("Writing gpg signing data to '%s'\n", name);
+ camel_stream_write_to_stream(istream, out);
+ camel_stream_reset(istream);
+ camel_object_unref(out);
+ }
+ g_free(name);
+ camel_debug_end();
+ }
+#endif
+
gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_SIGN);
gpg_ctx_set_hash (gpg, hash);
@@ -1413,6 +1444,32 @@
camel_object_unref (istream);
return NULL;
}
+
+#ifdef GPG_LOG
+ if (camel_debug_start("gpg:sign")) {
+ char *name;
+ CamelStream *out;
+
+ name = g_strdup_printf("camel-gpg.%d.verify.data", logid);
+ out = camel_stream_fs_new_with_name(name, O_CREAT|O_TRUNC|O_WRONLY, 0666);
+ if (out) {
+ printf("Writing gpg verify data to '%s'\n", name);
+ camel_stream_write_to_stream(istream, out);
+ camel_stream_reset(istream);
+ camel_object_unref(out);
+ }
+ g_free(name);
+ name = g_strdup_printf("camel-gpg.%d.verify.signature", logid++);
+ out = camel_stream_fs_new_with_name(name, O_CREAT|O_TRUNC|O_WRONLY, 0666);
+ if (out) {
+ printf("Writing gpg verify signature to '%s'\n", name);
+ camel_data_wrapper_write_to_stream((CamelDataWrapper *)sigpart, out);
+ camel_object_unref(out);
+ }
+ g_free(name);
+ camel_debug_end();
+ }
+#endif
sigfile = swrite (sigpart);
if (sigfile == NULL) {
@@ -1508,7 +1565,7 @@
_("Could not generate encrypting data: %s"), g_strerror(errno));
goto fail1;
}
-
+
gpg = gpg_ctx_new (context->session);
gpg_ctx_set_mode (gpg, GPG_CTX_MODE_ENCRYPT);
gpg_ctx_set_armor (gpg, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]