diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-29 11:16:57 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-29 11:16:57 +0800 |
commit | cc3ec1cb4827f8deb3b755778ed657dc9c26430e (patch) | |
tree | 345d7c7f4e6c5f8fe679416d51a399ec38e7aece | |
parent | f6ee20d9097f3ba7bce189f3015e65721d328122 (diff) | |
download | gsoc2013-evolution-cc3ec1cb4827f8deb3b755778ed657dc9c26430e.tar.gz gsoc2013-evolution-cc3ec1cb4827f8deb3b755778ed657dc9c26430e.tar.zst gsoc2013-evolution-cc3ec1cb4827f8deb3b755778ed657dc9c26430e.zip |
Initialize buf and diag_buf to NULL, hopefully this fixes the crash if the
2001-08-28 Jeffrey Stedfast <fejj@ximian.com>
* camel-pgp-context.c (crypto_exec_with_passwd): Initialize buf
and diag_buf to NULL, hopefully this fixes the crash if the
select() times out.
(pgp_encrypt): Argh. What was I thinking? Don't use "-r recipient"
as an argument, instead use "-r" and "recipient" as 2 separate
arguments to pgp. This might fix the "gpg only encrypts to my
private key" bug?
svn path=/trunk/; revision=12510
-rw-r--r-- | camel/ChangeLog | 4 | ||||
-rw-r--r-- | camel/camel-pgp-context.c | 49 |
2 files changed, 14 insertions, 39 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index d347c98956..a84dd18d4c 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -3,6 +3,10 @@ * camel-pgp-context.c (crypto_exec_with_passwd): Initialize buf and diag_buf to NULL, hopefully this fixes the crash if the select() times out. + (pgp_encrypt): Argh. What was I thinking? Don't use "-r recipient" + as an argument, instead use "-r" and "recipient" as 2 separate + arguments to pgp. This might fix the "gpg only encrypts to my + private key" bug? 2001-08-28 Peter Williams <peterw@ximian.com> diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index a8fef60ee4..ebd8d4027a 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -1047,7 +1047,6 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr CamelStream *istream, CamelStream *ostream, CamelException *ex) { CamelPgpContext *context = CAMEL_PGP_CONTEXT (ctx); - GPtrArray *recipient_list = NULL; GByteArray *plaintext; CamelStream *stream; GPtrArray *argv; @@ -1099,18 +1098,9 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr } argv = g_ptr_array_new (); - recipient_list = g_ptr_array_new (); switch (context->priv->type) { case CAMEL_PGP_TYPE_GPG: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup_printf ("-r %s", recipient); - g_ptr_array_add (recipient_list, buf); - } - g_ptr_array_add (argv, "gpg"); g_ptr_array_add (argv, "--verbose"); @@ -1119,8 +1109,10 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr g_ptr_array_add (argv, "--armor"); - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); + for (r = 0; r < recipients->len; r++) { + g_ptr_array_add (argv, "-r"); + g_ptr_array_add (argv, recipients->pdata[r]); + } g_ptr_array_add (argv, "--output"); g_ptr_array_add (argv, "-"); /* output to stdout */ @@ -1139,18 +1131,12 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr } break; case CAMEL_PGP_TYPE_PGP5: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup_printf ("-r %s", recipient); - g_ptr_array_add (recipient_list, buf); - } - g_ptr_array_add (argv, "pgpe"); - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); + for (r = 0; r < recipients->len; r++) { + g_ptr_array_add (argv, "-r"); + g_ptr_array_add (argv, recipients->pdata[r]); + } g_ptr_array_add (argv, "-f"); g_ptr_array_add (argv, "-z"); @@ -1170,14 +1156,6 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr break; case CAMEL_PGP_TYPE_PGP2: case CAMEL_PGP_TYPE_PGP6: - for (r = 0; r < recipients->len; r++) { - char *buf, *recipient; - - recipient = recipients->pdata[r]; - buf = g_strdup (recipient); - g_ptr_array_add (recipient_list, buf); - } - g_ptr_array_add (argv, "pgp"); g_ptr_array_add (argv, "-f"); g_ptr_array_add (argv, "-e"); @@ -1185,8 +1163,8 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr g_ptr_array_add (argv, "-o"); g_ptr_array_add (argv, "-"); - for (r = 0; r < recipient_list->len; r++) - g_ptr_array_add (argv, recipient_list->pdata[r]); + for (r = 0; r < recipients->len; r++) + g_ptr_array_add (argv, recipients->pdata[r]); if (sign) { g_ptr_array_add (argv, "-s"); @@ -1214,13 +1192,6 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr g_byte_array_free (plaintext, TRUE); - /* free the temp recipient list */ - if (recipient_list) { - for (r = 0; r < recipient_list->len; r++) - g_free (recipient_list->pdata[r]); - g_ptr_array_free (recipient_list, TRUE); - } - g_free (passphrase); g_ptr_array_free (argv, TRUE); |