aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-gpg-context.c13
2 files changed, 14 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6560ae570e..073285284a 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2002-06-22 Jeffrey Stedfast <fejj@ximian.com>
* camel-gpg-context.c (gpg_encrypt): Return -1 on error.
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;