aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/camel-pgp-context.c17
-rw-r--r--camel/camel-pgp-context.h3
3 files changed, 27 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c2145b3344..678dce9bc4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2001-07-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-pgp-context.c (pgp_sign): Forget the passphrase if the
+ user has set that option.
+ (pgp_clearsign): Same.
+ (pgp_encrypt): And here...
+ (pgp_decrypt): And finally here.
+ (camel_pgp_context_new): Take a `remember' argument.
+
2001-07-09 Not Zed <NotZed@Ximian.com>
* providers/local/camel-maildir-summary.c (maildir_summary_sync):
diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c
index aae330bc8e..cde9f76d25 100644
--- a/camel/camel-pgp-context.c
+++ b/camel/camel-pgp-context.c
@@ -58,6 +58,7 @@
struct _CamelPgpContextPrivate {
CamelPgpType type;
char *path;
+ gboolean remember;
};
static int pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
@@ -132,6 +133,7 @@ camel_pgp_context_get_type (void)
* @session: CamelSession
* @type: One of CAMEL_PGP_TYPE_PGP2, PGP5, GPG, or PGP6
* @path: path to PGP binary
+ * @remember: Remember the pgp passphrase
*
* This creates a new CamelPgpContext object which is used to sign,
* verify, encrypt and decrypt streams.
@@ -139,7 +141,7 @@ camel_pgp_context_get_type (void)
* Return value: the new CamelPgpContext
**/
CamelPgpContext *
-camel_pgp_context_new (CamelSession *session, CamelPgpType type, const char *path)
+camel_pgp_context_new (CamelSession *session, CamelPgpType type, const char *path, gboolean remember)
{
CamelPgpContext *context;
@@ -154,6 +156,7 @@ camel_pgp_context_new (CamelSession *session, CamelPgpType type, const char *pat
context->priv->type = type;
context->priv->path = g_strdup (path);
+ context->priv->remember = remember;
return context;
}
@@ -639,6 +642,9 @@ pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
return -1;
}
+ if (!context->priv->remember)
+ pgp_forget_passphrase (ctx->session, context->priv->type, (char *) userid);
+
g_free (diagnostics);
camel_stream_write (ostream, ciphertext, strlen (ciphertext));
@@ -808,6 +814,9 @@ pgp_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash
pgp_forget_passphrase (ctx->session, context->priv->type, (char *) userid);
}
+ if (!context->priv->remember)
+ pgp_forget_passphrase (ctx->session, context->priv->type, (char *) userid);
+
g_free (diagnostics);
camel_stream_write (ostream, ciphertext, strlen (ciphertext));
@@ -1220,6 +1229,9 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr
return -1;
}
+ if (!context->priv->remember)
+ pgp_forget_passphrase (ctx->session, context->priv->type, (char *) userid);
+
g_free (diagnostics);
camel_stream_write (ostream, ciphertext, strlen (ciphertext));
@@ -1346,6 +1358,9 @@ pgp_decrypt (CamelCipherContext *ctx, CamelStream *istream,
return -1;
}
+ if (!context->priv->remember)
+ pgp_forget_passphrase (ctx->session, context->priv->type, NULL);
+
g_free (diagnostics);
camel_stream_write (ostream, plaintext, plainlen);
diff --git a/camel/camel-pgp-context.h b/camel/camel-pgp-context.h
index 77a825737f..79149d60d4 100644
--- a/camel/camel-pgp-context.h
+++ b/camel/camel-pgp-context.h
@@ -60,7 +60,8 @@ typedef struct _CamelPgpContextClass {
CamelType camel_pgp_context_get_type (void);
-CamelPgpContext *camel_pgp_context_new (CamelSession *session, CamelPgpType type, const char *path);
+CamelPgpContext *camel_pgp_context_new (CamelSession *session, CamelPgpType type,
+ const char *path, gboolean remember);
/* PGP routines */
#define camel_pgp_sign(c, u, h, i, o, e) camel_cipher_sign (CAMEL_CIPHER_CONTEXT (c), u, h, i, o, e)