diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-06-24 10:50:53 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-06-24 10:50:53 +0800 |
commit | 149515b5dfedef4a26413f86b12da176c5ee671b (patch) | |
tree | 29214ecfb93f1e22c525bfc062a9903fc2ad61ec /camel/camel-gpg-context.c | |
parent | 1e62e1b055d9176e2f38b640be1bef3ce57d3b7f (diff) | |
download | gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar.gz gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar.bz2 gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar.lz gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar.xz gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.tar.zst gsoc2013-evolution-149515b5dfedef4a26413f86b12da176c5ee671b.zip |
Check for ERRSIG also. (gpg_ctx_op_step): Don't try writing a passphrase
2002-06-23 Jeffrey Stedfast <fejj@ximian.com>
* camel-gpg-context.c (gpg_ctx_parse_status): Check for ERRSIG
also.
(gpg_ctx_op_step): Don't try writing a passphrase unless our
operation requires it.
svn path=/trunk/; revision=17263
Diffstat (limited to 'camel/camel-gpg-context.c')
-rw-r--r-- | camel/camel-gpg-context.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c index e696cd08d2..985f51ecf8 100644 --- a/camel/camel-gpg-context.c +++ b/camel/camel-gpg-context.c @@ -281,7 +281,7 @@ static void gpg_ctx_set_mode (struct _GpgCtx *gpg, enum _GpgCtxMode mode) { gpg->mode = mode; - gpg->need_passwd = gpg->mode == GPG_CTX_MODE_SIGN || GPG_CTX_MODE_DECRYPT; + gpg->need_passwd = ((gpg->mode == GPG_CTX_MODE_SIGN) || (gpg->mode == GPG_CTX_MODE_DECRYPT)); } static void @@ -729,7 +729,10 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex) break; case GPG_CTX_MODE_VERIFY: /* FIXME: we should save this so we can present it to the user? */ - if (!strncmp (status, "TRUST_", 6) || !strncmp (status, "BADSIG ", 7)) + /* Note: NO_PUBKEY often comes after an ERRSIG, but do we really care? */ + if (!strncmp (status, "TRUST_", 6) || + !strncmp (status, "BADSIG", 6) || + !strncmp (status, "ERRSIG", 6)) gpg->complete = TRUE; break; case GPG_CTX_MODE_ENCRYPT: @@ -856,6 +859,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex) } } + gpg->reading = FALSE; if (FD_ISSET (gpg->stdout, &rdset) && gpg->ostream) { char buffer[4096]; ssize_t nread; @@ -872,9 +876,6 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex) /* make sure we don't exit before reading all the data... */ gpg->reading = TRUE; - } else { - /* we've safely read all the output */ - gpg->reading = FALSE; } } @@ -891,7 +892,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex) g_byte_array_append (gpg->diagnostics, buffer, nread); } - if (wrsetp && gpg->passwd_fd != -1 && FD_ISSET (gpg->passwd_fd, &wrset)) { + if (wrsetp && gpg->passwd_fd != -1 && FD_ISSET (gpg->passwd_fd, &wrset) && gpg->need_passwd) { if (gpg->send_passwd) { ssize_t w, nwritten = 0; size_t n; |