aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-04-23 02:13:49 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-04-23 02:13:49 +0800
commit469e6d297113db67c5b295bcb287e40e271f2d55 (patch)
tree57e49c6ccaea04753fcfa6bbfe1e0b4560c3010c
parent3c43802a3e6d892801b6a99e8fdf6c5976bf4044 (diff)
downloadgsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar.gz
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar.bz2
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar.lz
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar.xz
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.tar.zst
gsoc2013-evolution-469e6d297113db67c5b295bcb287e40e271f2d55.zip
Don't set seen_eof1 here anymore once we get a trust metric.
2003-04-21 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_ctx_parse_status): Don't set seen_eof1 here anymore once we get a trust metric. (gpg_ctx_new): Init seen_eof1 to TRUE here. (gpg_ctx_set_ostream): Change seen_eof1 to FALSE here this way we only ever have to set this if we are expecting output. (gpg_ctx_parse_status): Don't set seen_eof1 for importing either. (gpg_ctx_op_step): Only FD_SET() those fd's that we have not yet finished reading. svn path=/trunk/; revision=20922
-rw-r--r--camel/ChangeLog11
-rw-r--r--camel/camel-gpg-context.c37
2 files changed, 32 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e35775d5ea..07da3eecbb 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,14 @@
+2003-04-21 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-gpg-context.c (gpg_ctx_parse_status): Don't set seen_eof1
+ here anymore once we get a trust metric.
+ (gpg_ctx_new): Init seen_eof1 to TRUE here.
+ (gpg_ctx_set_ostream): Change seen_eof1 to FALSE here this way we
+ only ever have to set this if we are expecting output.
+ (gpg_ctx_parse_status): Don't set seen_eof1 for importing either.
+ (gpg_ctx_op_step): Only FD_SET() those fd's that we have not yet
+ finished reading.
+
2003-04-16 Jeffrey Stedfast <fejj@ximian.com>
* camel-url-scanner.c (camel_url_web_end): Urls are unlikely to
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 0483e8a16b..2ff800615d 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -300,7 +300,7 @@ gpg_ctx_new (CamelSession *session)
camel_object_ref (CAMEL_OBJECT (session));
gpg->userid_hint = g_hash_table_new (g_str_hash, g_str_equal);
gpg->complete = FALSE;
- gpg->seen_eof1 = FALSE;
+ gpg->seen_eof1 = TRUE;
gpg->seen_eof2 = FALSE;
gpg->pid = (pid_t) -1;
gpg->exit_status = 0;
@@ -424,6 +424,7 @@ gpg_ctx_set_ostream (struct _GpgCtx *gpg, CamelStream *ostream)
if (gpg->ostream)
camel_object_unref (CAMEL_OBJECT (gpg->ostream));
gpg->ostream = ostream;
+ gpg->seen_eof1 = FALSE;
}
static const char *
@@ -875,11 +876,6 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
} else if (!strncmp (status, "ULTIMATE", 8)) {
gpg->trust = GPG_TRUST_ULTIMATE;
}
-
- /* Since verifying a signature will never produce output
- on gpg's stdout descriptor, we use this EOF bit for
- making sure that we get a TRUST metric. */
- gpg->seen_eof1 = TRUE;
} else if (!strncmp (status, "VALIDSIG", 8)) {
gpg->validsig = TRUE;
} else if (!strncmp (status, "BADSIG", 6)) {
@@ -908,11 +904,7 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
}
break;
case GPG_CTX_MODE_IMPORT:
- /* hack to work around the fact that gpg
- doesn't write anything to stdout when
- importing keys */
- if (!strncmp (status, "IMPORT_RES", 10))
- gpg->seen_eof1 = TRUE;
+ /* noop */
break;
case GPG_CTX_MODE_EXPORT:
/* noop */
@@ -969,12 +961,21 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
retry:
FD_ZERO (&rdset);
- FD_SET (gpg->stdout_fd, &rdset);
- FD_SET (gpg->stderr_fd, &rdset);
- FD_SET (gpg->status_fd, &rdset);
- maxfd = MAX (gpg->stdout_fd, gpg->stderr_fd);
- maxfd = MAX (maxfd, gpg->status_fd);
+ if (!gpg->seen_eof1) {
+ FD_SET (gpg->stdout_fd, &rdset);
+ maxfd = MAX (maxfd, gpg->stdout_fd);
+ }
+
+ if (!gpg->seen_eof2) {
+ FD_SET (gpg->stderr_fd, &rdset);
+ maxfd = MAX (maxfd, gpg->stderr_fd);
+ }
+
+ if (!gpg->complete) {
+ FD_SET (gpg->status_fd, &rdset);
+ maxfd = MAX (maxfd, gpg->status_fd);
+ }
if (gpg->stdin_fd != -1 || gpg->passwd_fd != -1) {
FD_ZERO (&wrset);
@@ -990,6 +991,8 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
wrsetp = &wrset;
}
+ g_assert (maxfd > 0);
+
timeout.tv_sec = 10; /* timeout in seconds */
timeout.tv_usec = 0;
@@ -1184,6 +1187,7 @@ gpg_ctx_op_complete (struct _GpgCtx *gpg)
return gpg->complete && gpg->seen_eof1 && gpg->seen_eof2;
}
+#if 0
static gboolean
gpg_ctx_op_exited (struct _GpgCtx *gpg)
{
@@ -1202,6 +1206,7 @@ gpg_ctx_op_exited (struct _GpgCtx *gpg)
return FALSE;
}
+#endif
static void
gpg_ctx_op_cancel (struct _GpgCtx *gpg)