aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Tassin <fta+bugzilla@sofaraway.org>2010-05-29 11:17:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-05-29 11:17:58 +0800
commita52f00a9c9c00ecf06ac7179742ceb15e9971c5d (patch)
tree94c2330089a53645131745f02a8852f20a1de23d
parent578e0718258d8ad2b0739b588ba58252c61a785e (diff)
downloadgsoc2013-evolution-a52f00a9c9c00ecf06ac7179742ceb15e9971c5d.tar.gz
gsoc2013-evolution-a52f00a9c9c00ecf06ac7179742ceb15e9971c5d.tar.zst
gsoc2013-evolution-a52f00a9c9c00ecf06ac7179742ceb15e9971c5d.zip
Bug 585577 - Wrong FROM in envelope during SMTP negotiation
-rw-r--r--mail/mail-ops.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 128cb28c9c..e3ab0d5b97 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -515,8 +515,42 @@ mail_send_message (struct _send_queue_msg *m, CamelFolder *queue, const gchar *u
if (resent_from) {
camel_address_decode (from, resent_from);
} else {
- iaddr = camel_mime_message_get_from (message);
- camel_address_copy (from, CAMEL_ADDRESS (iaddr));
+ /* Don't get the 'from' from the headers */
+ /* See https://bugzilla.gnome.org/show_bug.cgi?id=585577 */
+ gchar *fake_msgid;
+ gchar *hostname;
+ EAccount *account;
+ gchar *address;
+ gchar *cp;
+
+ /* We use camel_header_msgid_generate () to get a canonical
+ * hostname, then skip the part leading to '@' */
+ fake_msgid = camel_header_msgid_generate ();
+ hostname = strchr (fake_msgid, '@');
+ hostname++;
+
+ /* wfm but it should probably be getpwent->pw_name instead */
+ account = e_get_default_account ();
+ if (!account) {
+ /* XXX Not sure what we should do here. */
+ address = g_strdup ("fakename");
+ } else {
+ address = g_strdup (
+ e_account_get_string (
+ account, E_ACCOUNT_ID_ADDRESS));
+ cp = strchr (address, '@');
+ if (cp != NULL)
+ *cp = '\0';
+ }
+
+ cp = g_strconcat (address, "@", hostname, NULL);
+ g_free (address);
+ address = cp;
+
+ camel_address_decode (from, address);
+
+ g_free (fake_msgid);
+ g_free (address);
}
recipients = (CamelAddress *) camel_internet_address_new ();