diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-04-10 23:47:00 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-04-10 23:47:00 +0800 |
commit | eee943f21ebc92e70cec963950c2fc0a29cab544 (patch) | |
tree | df2c372bcf6ea6cf9dad5c37a38e132d11d8625a /camel/camel-pgp-context.c | |
parent | bcc5969a21062e0e24bb5544df44a5accc0570e6 (diff) | |
download | gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar.gz gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar.bz2 gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar.lz gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar.xz gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.tar.zst gsoc2013-evolution-eee943f21ebc92e70cec963950c2fc0a29cab544.zip |
Added camel-pgp-context.[c,h] to the build. Also added tests/smime/pgp.c
2001-04-06 Jeffrey Stedfast <fejj@ximian.com>
* Makefile.am: Added camel-pgp-context.[c,h] to the build. Also
added tests/smime/pgp.c and Makefile.am
* tests/smime/pgp.c: New test suite for PGP functions.
* camel-pgp-context.c: Various fixes to get it to build.
svn path=/trunk/; revision=9213
Diffstat (limited to 'camel/camel-pgp-context.c')
-rw-r--r-- | camel/camel-pgp-context.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index 05e5a190d5..4dad8909b9 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -26,6 +26,9 @@ #include "camel-pgp-context.h" +#include "camel-stream-fs.h" +#include "camel-stream-mem.h" + #include <gtk/gtk.h> /* for _() macro */ #include <stdio.h> @@ -87,8 +90,6 @@ camel_pgp_context_finalise (CamelObject *o) CamelPgpContext *context = (CamelPgpContext *)o; camel_object_unref (CAMEL_OBJECT (context->priv->session)); - if (context->istream) - camel_object_unref (CAMEL_OBJECT (context->priv->istream)); g_free (context->priv->path); @@ -193,7 +194,7 @@ pgp_get_passphrase (CamelSession *session, CamelPgpType pgp_type, char *userid) /* Use the userid as a key if possible, else be generic and use the type */ passphrase = camel_session_query_authenticator (session, CAMEL_AUTHENTICATOR_ASK, - prompt, TRUE, NULL, userid ? userid : type, + prompt, TRUE, NULL, userid ? userid : (char *) type, NULL); g_free (prompt); @@ -203,13 +204,13 @@ pgp_get_passphrase (CamelSession *session, CamelPgpType pgp_type, char *userid) static void pgp_forget_passphrase (CamelSession *session, CamelPgpType pgp_type, char *userid) { - const char *type; + const char *type = NULL; if (!userid) type = pgp_get_type_as_string (pgp_type); camel_session_query_authenticator (session, CAMEL_AUTHENTICATOR_TELL, - NULL, FALSE, NULL, userid ? userid : type, + NULL, FALSE, NULL, userid ? userid : (char *) type, NULL); } @@ -291,7 +292,7 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int (pipe (op_fds) < 0 ) || (pipe (diag_fds) < 0 )) { *diagnostics = g_strdup_printf ("Couldn't create pipe to %s: " - "%s", pgp_path, + "%s", path, g_strerror (errno)); return 0; } @@ -526,7 +527,7 @@ camel_pgp_sign (CamelPgpContext *context, const char *userid, CamelPgpHashType h goto exception; } - passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, userid); + passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, (char *) userid); if (!passphrase) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No password provided.")); @@ -644,7 +645,7 @@ camel_pgp_sign (CamelPgpContext *context, const char *userid, CamelPgpHashType h "%s", diagnostics); g_free (diagnostics); g_free (ciphertext); - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, (char *) userid); PGP_UNLOCK(context); @@ -665,7 +666,7 @@ camel_pgp_sign (CamelPgpContext *context, const char *userid, CamelPgpHashType h g_byte_array_free (plaintext, TRUE); if (passphrase) { - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, (char *) userid); g_free (passphrase); } @@ -718,7 +719,7 @@ camel_pgp_clearsign (CamelPgpContext *context, const char *userid, CamelPgpHashT goto exception; } - passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, userid); + passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, (char *) userid); if (!passphrase) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No password provided.")); @@ -835,7 +836,7 @@ camel_pgp_clearsign (CamelPgpContext *context, const char *userid, CamelPgpHashT "%s", diagnostics); g_free (diagnostics); g_free (ciphertext); - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, (char *) userid); } g_free (diagnostics); @@ -852,7 +853,7 @@ camel_pgp_clearsign (CamelPgpContext *context, const char *userid, CamelPgpHashT g_byte_array_free (plaintext, TRUE); if (passphrase) { - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, (char *) userid); g_free (passphrase); } @@ -925,7 +926,7 @@ camel_pgp_verify (CamelPgpContext *context, CamelStream *istream, if (!plaintext->len) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("No plaintext to clearsign.")); + _("No plaintext to verify.")); goto exception; } @@ -1086,7 +1087,7 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, CamelStream *istream, CamelStream *ostream, CamelException *ex) { GPtrArray *recipient_list = NULL; - GByteArray *ciphertext; + GByteArray *plaintext; CamelStream *stream; GPtrArray *argv; int retval, r; @@ -1113,7 +1114,8 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, if (sign) { /* we only need a passphrase if we intend on signing */ - passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, userid); + passphrase = pgp_get_passphrase (context->priv->session, context->priv->type, + (char *) userid); if (!passphrase) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("No password provided.")); @@ -1148,7 +1150,6 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, recipient = recipients->pdata[r]; buf = g_strdup_printf ("-r %s", recipient); g_ptr_array_add (recipient_list, buf); - g_free (recipient); } g_ptr_array_add (argv, "gpg"); @@ -1185,7 +1186,6 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, recipient = recipients->pdata[r]; buf = g_strdup_printf ("-r %s", recipient); g_ptr_array_add (recipient_list, buf); - g_free (recipient); } g_ptr_array_add (argv, "pgpe"); @@ -1217,7 +1217,6 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, recipient = recipients->pdata[r]; buf = g_strdup (recipient); g_ptr_array_add (recipient_list, buf); - g_free (recipient); } g_ptr_array_add (argv, "pgp"); @@ -1254,7 +1253,7 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, &ciphertext, NULL, &diagnostics); - g_ptr_array_free (plaintext, TRUE); + g_byte_array_free (plaintext, TRUE); /* free the temp recipient list */ if (recipient_list) { @@ -1272,7 +1271,8 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, g_free (diagnostics); g_free (ciphertext); if (sign) - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, + (char *) userid); PGP_UNLOCK(context); @@ -1294,7 +1294,7 @@ camel_pgp_encrypt (CamelPgpContext *context, gboolean sign, const char *userid, if (sign) { g_free (passphrase); - pgp_forget_passphrase (context->priv->session, context->priv->type, userid); + pgp_forget_passphrase (context->priv->session, context->priv->type, (char *) userid); } PGP_UNLOCK(context); @@ -1325,7 +1325,7 @@ camel_pgp_decrypt (CamelPgpContext *context, CamelStream *istream, char *plaintext = NULL; int plainlen; char *diagnostics = NULL; - char *passphrase; + char *passphrase = NULL; int passwd_fds[2]; char passwd_fd[32]; int retval, i; |