aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-04-17 01:02:10 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-04-17 01:02:10 +0800
commit76e859fb6b176fea6b5c6b96516fa3cd54e155ac (patch)
treedcab43dda4c0932104a2e9c5613022e66c3907b4
parent3c0ee2d3df563f09948351c9306c7bb7e8813f02 (diff)
downloadgsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar.gz
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar.bz2
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar.lz
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar.xz
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.tar.zst
gsoc2013-evolution-76e859fb6b176fea6b5c6b96516fa3cd54e155ac.zip
The gpg child process exiting does not necessarily mean that we've ready
2003-04-15 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_verify): The gpg child process exiting does not necessarily mean that we've ready everything that we can from its pipes, so don't use gpg_ctx_op_exited() as a loop-exit condition. If for some reason the gpg child process does exit (due to an error), gpg_ctx_op_step() will eventually fail (as soon as it has finished reading any data in the pipes) and cause the loop to be terminated anyway. This fixes truncation of the gpg --verify stderr output that Evolution displays as the "validity report" (for lack of a better description). (gpg_ctx_op_step): Removed some debugging printf's (gpg_ctx_get_diagnostics): Use a bitfield to decide if we've already flushed the diagnostics stream, much simpler (plus we have plenty of bits to spare so might as well use them). (gpg_ctx_new): Fixed another logic bug which determined whether or not we should convert the gpg output from the locale charset into UTF-8. svn path=/trunk/; revision=20865
-rw-r--r--camel/ChangeLog19
-rw-r--r--camel/camel-gpg-context.c14
2 files changed, 27 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index ffda1e546e..78d6f813c4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,22 @@
+2003-04-15 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-gpg-context.c (gpg_verify): The gpg child process exiting
+ does not necessarily mean that we've ready everything that we can
+ from its pipes, so don't use gpg_ctx_op_exited() as a loop-exit
+ condition. If for some reason the gpg child process does exit (due
+ to an error), gpg_ctx_op_step() will eventually fail (as soon as
+ it has finished reading any data in the pipes) and cause the loop
+ to be terminated anyway. This fixes truncation of the gpg --verify
+ stderr output that Evolution displays as the "validity report"
+ (for lack of a better description).
+ (gpg_ctx_op_step): Removed some debugging printf's
+ (gpg_ctx_get_diagnostics): Use a bitfield to decide if we've
+ already flushed the diagnostics stream, much simpler (plus we have
+ plenty of bits to spare so might as well use them).
+ (gpg_ctx_new): Fixed another logic bug which determined whether or
+ not we should convert the gpg output from the locale charset into
+ UTF-8.
+
2003-04-10 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c: Turn off debugging if
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 7919056f9e..0483e8a16b 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -282,7 +282,9 @@ struct _GpgCtx {
unsigned int validsig:1;
unsigned int trust:3;
- unsigned int padding:18;
+ unsigned int diagflushed:1;
+
+ unsigned int padding:17;
};
static struct _GpgCtx *
@@ -334,8 +336,9 @@ gpg_ctx_new (CamelSession *session)
stream = camel_stream_mem_new ();
gpg->diagbuf = CAMEL_STREAM_MEM (stream)->buffer;
+ gpg->diagflushed = FALSE;
- if ((charset = e_iconv_locale_charset ()) && !strcasecmp (charset, "UTF-8")) {
+ if ((charset = e_iconv_locale_charset ()) && strcasecmp (charset, "UTF-8") != 0) {
CamelMimeFilterCharset *filter;
CamelStreamFilter *fstream;
@@ -426,7 +429,8 @@ gpg_ctx_set_ostream (struct _GpgCtx *gpg, CamelStream *ostream)
static const char *
gpg_ctx_get_diagnostics (struct _GpgCtx *gpg)
{
- if (!gpg->diagbuf->len || gpg->diagbuf->data[gpg->diagbuf->len - 1] != '\0') {
+ if (!gpg->diagflushed) {
+ gpg->diagflushed = TRUE;
camel_stream_flush (gpg->diagnostics);
if (gpg->diagbuf->len == 0)
return NULL;
@@ -1063,9 +1067,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
goto exception;
if (nread > 0) {
- printf ("pre-diag: %.*s\n", nread, buffer);
camel_stream_write (gpg->diagnostics, buffer, nread);
- printf ("post-diag: %.*s\n", gpg->diagbuf->len, gpg->diagbuf->data);
} else {
gpg->seen_eof2 = TRUE;
}
@@ -1390,7 +1392,7 @@ gpg_verify (CamelCipherContext *context, CamelCipherHash hash,
goto exception;
}
- while (!gpg_ctx_op_complete (gpg) && !gpg_ctx_op_exited (gpg)) {
+ while (!gpg_ctx_op_complete (gpg)) {
if (camel_operation_cancel_check (NULL)) {
camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
_("Cancelled."));