aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-pgp-context.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-07-10 05:31:09 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-07-10 05:31:09 +0800
commitebd5da4c959c595723d3d4d48cf8ef0978162177 (patch)
treedf901329b62fd11cbeb57f19e0dd77dd9a5a8fcf /camel/camel-pgp-context.c
parente67f0c1d828de49b796b72181a6ddd1c51900a25 (diff)
downloadgsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar.gz
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar.bz2
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar.lz
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar.xz
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.tar.zst
gsoc2013-evolution-ebd5da4c959c595723d3d4d48cf8ef0978162177.zip
Forget the passphrase if the user has set that option. (pgp_clearsign):
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. svn path=/trunk/; revision=10932
Diffstat (limited to 'camel/camel-pgp-context.c')
-rw-r--r--camel/camel-pgp-context.c17
1 files changed, 16 insertions, 1 deletions
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);