static void pgpmime_free_privacydata(PrivacyData *_data)
{
PrivacyDataPGP *data = (PrivacyDataPGP *) _data;
-
+ gpgme_release(data->ctx);
g_free(data);
}
plain = sgpgme_decrypt_verify(cipher, &sigstat, ctx);
gpgme_data_release(cipher);
- if (plain == NULL)
+ if (plain == NULL) {
+ gpgme_release(ctx);
return NULL;
-
+ }
+
fname = g_strdup_printf("%s%cplaintext.%08x",
get_mime_tmp_dir(), G_DIR_SEPARATOR, ++id);
FILE_OP_ERROR(fname, "fopen");
g_free(fname);
gpgme_data_release(plain);
+ gpgme_release(ctx);
return NULL;
}
parseinfo = procmime_scan_file(fname);
g_free(fname);
- if (parseinfo == NULL)
+ if (parseinfo == NULL) {
+ gpgme_release(ctx);
return NULL;
+ }
decinfo = g_node_first_child(parseinfo->node) != NULL ?
g_node_first_child(parseinfo->node)->data : NULL;
- if (decinfo == NULL)
+ if (decinfo == NULL) {
+ gpgme_release(ctx);
return NULL;
+ }
g_node_unlink(decinfo->node);
procmime_mimeinfo_free_all(parseinfo);
return NULL;
}
-gboolean pgpmime_sign(MimeInfo *mimeinfo)
+gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account)
{
MimeInfo *msgcontent, *sigmultipart, *newinfo;
gchar *textstr, *opinfo, *micalg;
gchar *boundary, *sigcontent;
GpgmeCtx ctx;
GpgmeData gpgtext, gpgsig;
- guint len;
+ size_t len;
struct passphrase_cb_info_s info;
-
+
memset (&info, 0, sizeof info);
/* remove content node from message */
gpgme_new(&ctx);
gpgme_set_textmode(ctx, 1);
gpgme_set_armor(ctx, 1);
- gpgme_signers_clear(ctx);
+
+ if (!sgpgme_setup_signers(ctx, account)) {
+ gpgme_release(ctx);
+ return FALSE;
+ }
if (!getenv("GPG_AGENT_INFO")) {
info.c = ctx;
gpgme_set_passphrase_cb (ctx, gpgmegtk_passphrase_cb, &info);
}
- if (gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH) != GPGME_No_Error)
+ if (gpgme_op_sign(ctx, gpgtext, gpgsig, GPGME_SIG_MODE_DETACH) != GPGME_No_Error) {
+ gpgme_release(ctx);
return FALSE;
+ }
opinfo = gpgme_get_op_info(ctx, 0);
micalg = extract_micalg(opinfo);
g_free(opinfo);
MimeInfo *msgcontent, *encmultipart, *newinfo;
FILE *fp;
gchar *boundary, *enccontent;
- guint len;
+ size_t len;
gchar *textstr;
GpgmeData gpgtext, gpgenc;
gchar **recipients, **nextrecp;
static PrivacySystem pgpmime_system = {
"pgpmime", /* id */
- "PGP Mime", /* name */
+ "PGP/MIME", /* name */
pgpmime_free_privacydata, /* free_privacydata */