diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-09-28 05:47:28 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-09-28 05:47:28 +0000 |
commit | 06d0ac5cfb2d71e3fab66d403b53b7d6080d48ce (patch) | |
tree | a9eea31c8bb03ee5cd74ed2578ce3a387919ffe8 /src | |
parent | a7102dc008b3526236fd976a63fb61816dde7ed3 (diff) |
fixed the crash when try to use ascii-armored PGP encryption.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1917 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/compose.c | 54 | ||||
-rw-r--r-- | src/select-keys.c | 2 |
2 files changed, 34 insertions, 22 deletions
diff --git a/src/compose.c b/src/compose.c index 5b453336..71691daf 100644 --- a/src/compose.c +++ b/src/compose.c @@ -3252,32 +3252,13 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, } if (rfc2015_is_available() && !is_draft) { - gint ret; - - if (compose->use_encryption && compose->account->ascii_armored) { - if (compose->use_signing) - ret = compose_encrypt_sign_armored(compose, &buf); - else - ret = compose_encrypt_armored(compose, &buf); - if (ret < 0) { - g_warning("ascii-armored encryption failed\n"); - fclose(fp); - g_unlink(file); - g_free(buf); - return -1; - } - } else if (compose->use_signing && compose->account->clearsign) { + if ((compose->use_encryption && + compose->account->ascii_armored) || + (compose->use_signing && compose->account->clearsign)) { /* MIME encoding doesn't fit with cleartext signature */ if (encoding == ENC_QUOTED_PRINTABLE || encoding == ENC_BASE64) encoding = ENC_8BIT; - if (compose_clearsign_text(compose, &buf) < 0) { - g_warning("clearsign failed\n"); - fclose(fp); - g_unlink(file); - g_free(buf); - return -1; - } } } #endif @@ -3322,6 +3303,35 @@ static gint compose_write_to_file(Compose *compose, const gchar *file, return -1; } +#if USE_GPGME + /* do ascii-armor encryption and/or clearsign */ + if (rfc2015_is_available() && !is_draft) { + gint ret; + + if (compose->use_encryption && compose->account->ascii_armored) { + if (compose->use_signing) + ret = compose_encrypt_sign_armored(compose, &buf); + else + ret = compose_encrypt_armored(compose, &buf); + if (ret < 0) { + g_warning("ascii-armored encryption failed\n"); + fclose(fp); + g_unlink(file); + g_free(buf); + return -1; + } + } else if (compose->use_signing && compose->account->clearsign) { + if (compose_clearsign_text(compose, &buf) < 0) { + g_warning("clearsign failed\n"); + fclose(fp); + g_unlink(file); + g_free(buf); + return -1; + } + } + } +#endif + if (compose->use_attach && gtk_tree_model_iter_n_children(model, NULL) > 0) { #if USE_GPGME diff --git a/src/select-keys.c b/src/select-keys.c index e5976569..d8394a93 100644 --- a/src/select-keys.c +++ b/src/select-keys.c @@ -101,6 +101,8 @@ update_progress (struct select_keys_s *sk, int running, const char *pattern) static int windmill[] = { '-', '\\', '|', '/' }; char *buf; + if (!pattern) + pattern = ""; if (!running) buf = g_strdup_printf (_("Please select key for `%s'"), pattern); |