aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/mimeview.c21
-rw-r--r--src/rfc2015.c15
3 files changed, 31 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index bd9b6369..e8fbfb30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-04
+
+ * src/mimeview.c
+ src/rfc2015.c: fixed crash when checking signature while GnuPG is
+ not available.
+
2010-02-02
* src/addr_compl.c: address_completion_complete_address_in_entry():
diff --git a/src/mimeview.c b/src/mimeview.c
index 8d5045e7..13db36f9 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2010 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -296,6 +296,7 @@ static gboolean mimeview_is_signed(MimeView *mimeview)
if (!mimeview) return FALSE;
if (!mimeview->opened) return FALSE;
+ if (!rfc2015_is_available()) return FALSE;
debug_print("mimeview_is_signed: open\n" );
@@ -321,6 +322,8 @@ static void set_unchecked_signature(MimeInfo *mimeinfo)
{
MimeInfo **signedinfo;
+ if (!rfc2015_is_available()) return;
+
signedinfo = rfc2015_find_signature(mimeinfo);
if (signedinfo == NULL) return;
@@ -353,7 +356,7 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
mimeview->file = g_strdup(file);
#if USE_GPGME
- if (prefs_common.auto_check_signatures) {
+ if (rfc2015_is_available() && prefs_common.auto_check_signatures) {
FILE *fp;
if ((fp = g_fopen(file, "rb")) == NULL) {
@@ -719,10 +722,13 @@ static void mimeview_show_signature_part(MimeView *mimeview,
vbbox = gtk_vbutton_box_new();
gtk_box_set_spacing(GTK_BOX(vbbox), 5);
- button = gtk_button_new_with_mnemonic(_("_Check signature"));
- gtk_container_add(GTK_CONTAINER(vbbox), button);
- g_signal_connect(button, "clicked",
- G_CALLBACK(check_signature_button_clicked), mimeview);
+ if (rfc2015_is_available()) {
+ button = gtk_button_new_with_mnemonic(_("_Check signature"));
+ gtk_container_add(GTK_CONTAINER(vbbox), button);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(check_signature_button_clicked),
+ mimeview);
+ }
gtk_widget_show_all(vbbox);
@@ -1341,6 +1347,9 @@ static void mimeview_check_signature(MimeView *mimeview)
g_return_if_fail (mimeview_is_signed(mimeview));
+ if (!rfc2015_is_available())
+ return;
+
mimeinfo = mimeview_get_selected_part(mimeview);
g_return_if_fail(mimeinfo != NULL);
g_return_if_fail(mimeview->file != NULL);
diff --git a/src/rfc2015.c b/src/rfc2015.c
index 7bf195ff..432580e7 100644
--- a/src/rfc2015.c
+++ b/src/rfc2015.c
@@ -316,7 +316,8 @@ leave:
gpgme_data_release(sig);
gpgme_data_release(text);
- gpgme_release(ctx);
+ if (ctx)
+ gpgme_release(ctx);
if (prefs_common.gpg_signature_popup)
gpgmegtk_sig_status_destroy(statuswindow);
}
@@ -436,7 +437,8 @@ static gpgme_data_t pgp_decrypt(MsgInfo *msginfo, MimeInfo *partinfo, FILE *fp)
leave:
gpgme_data_release(cipher);
- gpgme_release(ctx);
+ if (ctx)
+ gpgme_release(ctx);
return plain;
}
@@ -815,7 +817,8 @@ static gpgme_data_t pgp_encrypt(gpgme_data_t plain, gpgme_key_t kset[])
debug_print("** encryption succeeded\n");
}
- gpgme_release(ctx);
+ if (ctx)
+ gpgme_release(ctx);
return cipher;
}
@@ -1276,7 +1279,8 @@ leave:
debug_print("signing succeeded\n");
}
- gpgme_release(ctx);
+ if (ctx)
+ gpgme_release(ctx);
return sig;
}
@@ -1352,7 +1356,8 @@ leave:
debug_print("encryption and signing succeeded\n");
}
- gpgme_release(ctx);
+ if (ctx)
+ gpgme_release(ctx);
return cipher;
}