aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog30
-rw-r--r--mail/mail-config.c349
-rw-r--r--mail/mail-config.glade76
-rw-r--r--mail/mail-config.h16
-rw-r--r--mail/mail-crypto.c2
-rw-r--r--mail/mail-format.c6
-rw-r--r--mail/mail-preferences.c21
-rw-r--r--mail/mail-preferences.h3
8 files changed, 37 insertions, 466 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8de89bb23f..d8a9f89ae9 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,35 @@
2002-10-16 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-format.c (handle_multipart_signed): Don't need to pass a
+ path to camel_gpg_context_new () anymore.
+ (mail_get_message_body): Same here.
+ (handle_multipart_encrypted): Use camel_gpg_context_new () instead
+ of mail_crypto_get_pgp_cipher_context ().
+
+ * mail-preferences.c (mail_preferences_construct): There's no
+ security tab anymore.
+ (mail_preferences_apply): No need to save any pgp config data,
+ there's nothing to configure!
+
+ * mail-crypto.c (mail_crypto_get_pgp_cipher_context): Updated to
+ not pass a pgp path into camel_gpg_context_new ().
+
+ * mail-config.c (mail_config_clear): No need to free a pgp_path
+ variable anymore, we don't need one.
+ (config_read): Don't read in a pgp-path or pgp-type anymore.
+ (mail_config_write_on_exit): Don't save a pgp-path or pgp-type
+ anymore, we don't use them.
+ (pgpopen): Removed.
+ (pgpclose): Removed.
+ (mail_config_pgp_type_detect_from_path): Removed.
+ (auto_detect_pgp_variables): Removed.
+ (mail_config_get_pgp_type): Removed.
+ (mail_config_set_pgp_type): Removed.
+ (mail_config_get_pgp_path): Removed.
+ (mail_config_set_pgp_path): Removed.
+
+2002-10-16 Jeffrey Stedfast <fejj@ximian.com>
+
* mail-callbacks.c (mail_generate_reply): If mode == REPLY_LIST
and the mlist is "" (we only checked NULL before), change the mode
to REPLY_ALL so that we don't accidently reply to the user's
diff --git a/mail/mail-config.c b/mail/mail-config.c
index a019519738..58a7a111e3 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -26,19 +26,11 @@
#include <config.h>
#endif
-/* this group of headers is for pgp detection */
-#include <stdlib.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <termios.h>
-#include <unistd.h>
-#include <errno.h>
-
#include <pwd.h>
#include <ctype.h>
+#include <sys/wait.h>
+#include <signal.h>
+#include <errno.h>
#include <glib.h>
#include <libgnome/gnome-defs.h>
@@ -107,9 +99,6 @@ typedef struct {
GSList *accounts;
int default_account;
- char *pgp_path;
- int pgp_type;
-
MailConfigHTTPMode http_mode;
MailConfigForwardStyle default_forward_style;
MailConfigReplyStyle default_reply_style;
@@ -358,9 +347,6 @@ mail_config_clear (void)
config->accounts = NULL;
}
- g_free (config->pgp_path);
- config->pgp_path = NULL;
-
g_free (config->default_charset);
config->default_charset = NULL;
@@ -884,19 +870,6 @@ config_read (void)
config->confirm_goto_next_folder = bonobo_config_get_boolean_with_default (
config->db, "/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL);
- /* PGP/GPG */
- config->pgp_path = bonobo_config_get_string (config->db, "/Mail/PGP/path", NULL);
-
- config->pgp_type = bonobo_config_get_long_with_default (config->db,
- "/Mail/PGP/type", MAIL_CONFIG_PGP_TYPE_NONE, NULL);
-
- /* we only support GnuPG now */
- if (config->pgp_type != MAIL_CONFIG_PGP_TYPE_GPG) {
- config->pgp_type = MAIL_CONFIG_PGP_TYPE_NONE;
- g_free (config->pgp_path);
- config->pgp_path = NULL;
- }
-
/* HTTP images */
config->http_mode = bonobo_config_get_long_with_default (config->db,
"/Mail/Display/http_images", MAIL_CONFIG_HTTP_NEVER, NULL);
@@ -1276,13 +1249,6 @@ mail_config_write_on_exit (void)
bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_goto_next_folder",
config->confirm_goto_next_folder, NULL);
- /* PGP/GPG */
- bonobo_config_set_string_wrapper (config->db, "/Mail/PGP/path",
- config->pgp_path, NULL);
-
- bonobo_config_set_long (config->db, "/Mail/PGP/type",
- config->pgp_type, NULL);
-
/* HTTP images */
bonobo_config_set_long (config->db, "/Mail/Display/http_images",
config->http_mode, NULL);
@@ -1768,315 +1734,6 @@ mail_config_set_goto_next_folder (gboolean value)
config->goto_next_folder = value;
}
-struct {
- char *bin;
- char *version;
- int type;
-} binaries[] = {
- { "gpg", NULL, MAIL_CONFIG_PGP_TYPE_GPG },
- { "pgp", "6.5.8", MAIL_CONFIG_PGP_TYPE_PGP6 },
- { "pgp", "5.0", MAIL_CONFIG_PGP_TYPE_PGP5 },
- { "pgp", "2.6", MAIL_CONFIG_PGP_TYPE_PGP2 },
- { NULL, NULL, MAIL_CONFIG_PGP_TYPE_NONE }
-};
-
-
-typedef struct _PGPFILE {
- FILE *fp;
- pid_t pid;
-} PGPFILE;
-
-static PGPFILE *
-pgpopen (const char *command, const char *mode)
-{
- int in_fds[2], out_fds[2];
- PGPFILE *pgp = NULL;
- char **argv = NULL;
- pid_t child;
- int fd;
-
- g_return_val_if_fail (command != NULL, NULL);
-
- if (*mode != 'r' && *mode != 'w')
- return NULL;
-
- argv = g_strsplit (command, " ", 0);
- if (!argv)
- return NULL;
-
- if (pipe (in_fds) == -1)
- goto error;
-
- if (pipe (out_fds) == -1) {
- close (in_fds[0]);
- close (in_fds[1]);
- goto error;
- }
-
- if ((child = fork ()) == 0) {
- /* In child */
- int maxfd;
-
- if ((dup2 (in_fds[0], STDIN_FILENO) < 0 ) ||
- (dup2 (out_fds[1], STDOUT_FILENO) < 0 ) ||
- (dup2 (out_fds[1], STDERR_FILENO) < 0 )) {
- _exit (255);
- }
-
- /* Dissociate from evolution-mail's controlling
- * terminal so that pgp/gpg won't be able to read from
- * it: PGP 2 will fall back to asking for the password
- * on /dev/tty if the passed-in password is incorrect.
- * This will make that fail rather than hanging.
- */
- setsid ();
-
- /* close all open fds that we aren't using */
- maxfd = sysconf (_SC_OPEN_MAX);
- for (fd = 0; fd < maxfd; fd++) {
- if (fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO)
- close (fd);
- }
-
- execvp (argv[0], argv);
- fprintf (stderr, "Could not execute %s: %s\n", argv[0],
- g_strerror (errno));
- _exit (255);
- } else if (child < 0) {
- close (in_fds[0]);
- close (in_fds[1]);
- close (out_fds[0]);
- close (out_fds[1]);
- goto error;
- }
-
- /* Parent */
- g_strfreev (argv);
-
- close (in_fds[0]); /* pgp's stdin */
- close (out_fds[1]); /* pgp's stdout */
-
- if (mode[0] == 'r') {
- /* opening in read-mode */
- fd = out_fds[0];
- close (in_fds[1]);
- } else {
- /* opening in write-mode */
- fd = in_fds[1];
- close (out_fds[0]);
- }
-
- pgp = g_new (PGPFILE, 1);
- pgp->fp = fdopen (fd, mode);
- pgp->pid = child;
-
- return pgp;
- error:
- g_strfreev (argv);
-
- return NULL;
-}
-
-static int
-pgpclose (PGPFILE *pgp)
-{
- sigset_t mask, omask;
- pid_t wait_result;
- int status;
-
- if (pgp->fp) {
- fclose (pgp->fp);
- pgp->fp = NULL;
- }
-
- /* PGP5 closes fds before exiting, meaning this might be called
- * too early. So wait a bit for the result.
- */
- sigemptyset (&mask);
- sigaddset (&mask, SIGALRM);
- sigprocmask (SIG_BLOCK, &mask, &omask);
- alarm (1);
- wait_result = waitpid (pgp->pid, &status, 0);
- alarm (0);
- sigprocmask (SIG_SETMASK, &omask, NULL);
-
- if (wait_result == -1 && errno == EINTR) {
- /* PGP is hanging: send a friendly reminder. */
- kill (pgp->pid, SIGTERM);
- sleep (1);
- wait_result = waitpid (pgp->pid, &status, WNOHANG);
- if (wait_result == 0) {
- /* Still hanging; use brute force. */
- kill (pgp->pid, SIGKILL);
- sleep (1);
- wait_result = waitpid (pgp->pid, &status, WNOHANG);
- }
- }
-
- if (wait_result != -1 && WIFEXITED (status)) {
- g_free (pgp);
- return 0;
- } else
- return -1;
-}
-
-int
-mail_config_pgp_type_detect_from_path (const char *pgp)
-{
- const char *bin = g_basename (pgp);
- struct stat st;
- int i;
-
- /* make sure the file exists *and* is executable? */
- if (stat (pgp, &st) == -1 || !(st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)))
- return MAIL_CONFIG_PGP_TYPE_NONE;
-
- for (i = 0; binaries[i].bin; i++) {
- if (binaries[i].version) {
- /* compare version strings */
- char buffer[256], *command;
- gboolean found = FALSE;
- PGPFILE *fp;
-
- command = g_strdup_printf ("%s --version", pgp);
- fp = pgpopen (command, "r");
- g_free (command);
- if (fp) {
- while (!feof (fp->fp) && !found) {
- memset (buffer, 0, sizeof (buffer));
- fgets (buffer, sizeof (buffer), fp->fp);
- found = strstr (buffer, binaries[i].version) != NULL;
- }
-
- pgpclose (fp);
-
- if (found)
- return binaries[i].type;
- }
- } else if (!strcmp (binaries[i].bin, bin)) {
- /* no version string to compare against... */
- return binaries[i].type;
- }
- }
-
- return MAIL_CONFIG_PGP_TYPE_NONE;
-}
-
-static void
-auto_detect_pgp_variables (void)
-{
- int type = MAIL_CONFIG_PGP_TYPE_NONE;
- const char *PATH, *path;
- char *pgp = NULL;
-
- PATH = getenv ("PATH");
-
- path = PATH;
- while (path && *path && !type) {
- const char *pend = strchr (path, ':');
- gboolean found = FALSE;
- char *dirname;
- int i;
-
- if (pend) {
- /* don't even think of using "." */
- if (!strncmp (path, ".", pend - path)) {
- path = pend + 1;
- continue;
- }
-
- dirname = g_strndup (path, pend - path);
- path = pend + 1;
- } else {
- /* don't even think of using "." */
- if (!strcmp (path, "."))
- break;
-
- dirname = g_strdup (path);
- path = NULL;
- }
-
- for (i = 0; binaries[i].bin; i++) {
- struct stat st;
-
- pgp = g_strdup_printf ("%s/%s", dirname, binaries[i].bin);
- /* make sure the file exists *and* is executable? */
- if (stat (pgp, &st) != -1 && st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR)) {
- if (binaries[i].version) {
- /* compare version strings */
- char buffer[256], *command;
- PGPFILE *fp;
-
- command = g_strdup_printf ("%s --version", pgp);
- fp = pgpopen (command, "r");
- g_free (command);
- if (fp) {
- while (!feof (fp->fp) && !found) {
- memset (buffer, 0, sizeof (buffer));
- fgets (buffer, sizeof (buffer), fp->fp);
- found = strstr (buffer, binaries[i].version) != NULL;
- }
-
- pgpclose (fp);
- }
- } else {
- /* no version string to compare against... */
- found = TRUE;
- }
-
- if (found) {
- type = binaries[i].type;
- break;
- }
- }
-
- g_free (pgp);
- pgp = NULL;
- }
-
- g_free (dirname);
- }
-
- if (pgp && type) {
- mail_config_set_pgp_path (pgp);
- mail_config_set_pgp_type (type);
- }
-
- g_free (pgp);
-}
-
-int
-mail_config_get_pgp_type (void)
-{
- if (!config->pgp_path || !config->pgp_type)
- auto_detect_pgp_variables ();
-
- return config->pgp_type;
-}
-
-void
-mail_config_set_pgp_type (int pgp_type)
-{
- config->pgp_type = pgp_type;
-}
-
-const char *
-mail_config_get_pgp_path (void)
-{
- if (!config->pgp_path || !config->pgp_type)
- auto_detect_pgp_variables ();
-
- return config->pgp_path;
-}
-
-void
-mail_config_set_pgp_path (const char *pgp_path)
-{
- g_free (config->pgp_path);
-
- config->pgp_path = g_strdup (pgp_path);
-}
-
MailConfigHTTPMode
mail_config_get_http_mode (void)
{
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 201bda6cf4..6c43dc9852 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -3111,82 +3111,6 @@ Baltic (ISO-8859-4)
</widget>
<widget>
- <class>GtkVBox</class>
- <name>vboxSecurity</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkHBox</class>
- <name>hboxPgpPath</name>
- <border_width>4</border_width>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>lblPgpPath</name>
- <label>_PGP binary path:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <default_focus_target>combo-entry1</default_focus_target>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GnomeFileEntry</class>
- <name>filePgpPath</name>
- <max_saved>4</max_saved>
- <title>Select PGP program</title>
- <directory>False</directory>
- <modal>True</modal>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GnomeEntry:entry</child_name>
- <name>combo-entry1</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>lblSecurity</name>
- <label>_Security</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
<class>GtkFrame</class>
<name>frameColours</name>
<border_width>4</border_width>
diff --git a/mail/mail-config.h b/mail/mail-config.h
index 95159faafe..3b8732b97b 100644
--- a/mail/mail-config.h
+++ b/mail/mail-config.h
@@ -31,14 +31,6 @@ extern "C" {
#pragma }
#endif /* __cplusplus */
-enum {
- MAIL_CONFIG_PGP_TYPE_NONE,
- MAIL_CONFIG_PGP_TYPE_PGP2, /* no longer supported */
- MAIL_CONFIG_PGP_TYPE_PGP5, /* no longer supported */
- MAIL_CONFIG_PGP_TYPE_PGP6, /* no longer supported */
- MAIL_CONFIG_PGP_TYPE_GPG
-};
-
typedef struct {
int id;
char *name;
@@ -229,14 +221,6 @@ void mail_config_set_confirm_goto_next_folder (gboolean value);
gboolean mail_config_get_goto_next_folder (void);
void mail_config_set_goto_next_folder (gboolean value);
-int mail_config_pgp_type_detect_from_path (const char *pgp);
-
-int mail_config_get_pgp_type (void);
-void mail_config_set_pgp_type (int pgp_type);
-
-const char *mail_config_get_pgp_path (void);
-void mail_config_set_pgp_path (const char *pgp_path);
-
MailConfigHTTPMode mail_config_get_http_mode (void);
void mail_config_set_http_mode (MailConfigHTTPMode);
diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c
index 7eb604286b..115745d247 100644
--- a/mail/mail-crypto.c
+++ b/mail/mail-crypto.c
@@ -44,7 +44,7 @@ mail_crypto_get_pgp_cipher_context (const MailConfigAccount *account)
{
CamelCipherContext *cipher;
- cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ());
+ cipher = camel_gpg_context_new (session);
if (account)
camel_gpg_context_set_always_trust ((CamelGpgContext *) cipher, account->pgp_always_trust);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index dc63788b66..451b8a1ce1 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1759,7 +1759,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
mpe = CAMEL_MULTIPART_ENCRYPTED (wrapper);
camel_exception_init (&ex);
- cipher = mail_crypto_get_pgp_cipher_context (NULL);
+ cipher = camel_gpg_context_new (session);
mime_part = camel_multipart_encrypted_decrypt (mpe, cipher, &ex);
camel_object_unref (cipher);
@@ -1847,7 +1847,7 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
/* Write out the verification results */
/* TODO: use the right context for the right message ... */
camel_exception_init (&ex);
- cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ());
+ cipher = camel_gpg_context_new (session);
if (cipher) {
valid = camel_multipart_signed_verify (mps, cipher, &ex);
camel_object_unref (CAMEL_OBJECT (cipher));
@@ -2375,7 +2375,7 @@ mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean cit
mp = CAMEL_MULTIPART (data);
if (CAMEL_IS_MULTIPART_ENCRYPTED (mp)) {
- cipher = camel_gpg_context_new (session, mail_config_get_pgp_path ());
+ cipher = camel_gpg_context_new (session);
subpart = camel_multipart_encrypted_decrypt (CAMEL_MULTIPART_ENCRYPTED (mp),
cipher, NULL);
if (!subpart)
diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c
index 7fab3c1567..758f9cd540 100644
--- a/mail/mail-preferences.c
+++ b/mail/mail-preferences.c
@@ -309,16 +309,6 @@ mail_preferences_construct (MailPreferences *prefs)
gtk_signal_connect (GTK_OBJECT (prefs->prompt_unwanted_html), "toggled",
toggle_button_toggled, prefs);
- /* Security tab */
-
- /* Pretty Good Privacy */
- prefs->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath"));
- text = mail_config_get_pgp_path ();
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->pgp_path)), text ? text : "");
- gnome_file_entry_set_default_path (prefs->pgp_path, mail_config_get_pgp_path ());
- gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->pgp_path)), "changed",
- entry_changed, prefs);
-
/* Labels and Colours tab */
for (i = 0; i < 5; i++) {
char *widget_name;
@@ -360,7 +350,6 @@ void
mail_preferences_apply (MailPreferences *prefs)
{
GtkWidget *entry, *menu;
- int pgp_type;
char *string;
guint32 rgb;
int i, val;
@@ -414,16 +403,6 @@ mail_preferences_apply (MailPreferences *prefs)
mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (prefs->prompt_unwanted_html));
- /* Security */
- entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->pgp_path));
- string = gtk_entry_get_text (GTK_ENTRY (entry));
-
- pgp_type = string && *string ? mail_config_pgp_type_detect_from_path (string) : MAIL_CONFIG_PGP_TYPE_NONE;
- if (pgp_type == MAIL_CONFIG_PGP_TYPE_GPG) {
- mail_config_set_pgp_path (string && *string ? string : NULL);
- mail_config_set_pgp_type (pgp_type);
- }
-
/* Labels and Colours */
for (i = 0; i < 5; i++) {
/* save the label... */
diff --git a/mail/mail-preferences.h b/mail/mail-preferences.h
index 86317a5239..36835f018e 100644
--- a/mail/mail-preferences.h
+++ b/mail/mail-preferences.h
@@ -93,9 +93,6 @@ struct _MailPreferences {
/* GtkHTML Properties */
GtkHTMLPropmanager *pman;
- /* Security tab */
- GnomeFileEntry *pgp_path;
-
/* Labels and Colours tab */
struct {
GtkEntry *name;