diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-02-23 09:23:43 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-02-23 09:23:43 +0800 |
commit | a9d623d22fdcf65d759e968f51c33234ac63b60d (patch) | |
tree | 109672ef61bdb82756a5328292b9a61eba5b1dde /camel/providers | |
parent | 9e2cde2a1da215fdc8a5e451e4f93ba8761a4420 (diff) | |
download | gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.gz gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.bz2 gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.lz gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.xz gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.zst gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.zip |
Remove all Bcc headers before sending to the smtp server.
2003-02-22 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_data): Remove all
Bcc headers before sending to the smtp server.
* providers/sendmail/camel-sendmail-transport.c
(sendmail_send_to): Remove all Bcc headers before sending to
sendmail.
svn path=/trunk/; revision=20000
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/sendmail/camel-sendmail-transport.c | 45 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 22 |
2 files changed, 53 insertions, 14 deletions
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c index 1af237f239..58993da96d 100644 --- a/camel/providers/sendmail/camel-sendmail-transport.c +++ b/camel/providers/sendmail/camel-sendmail-transport.c @@ -87,10 +87,12 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, { const char *from_addr, *addr, **argv; int i, len, fd[2], nullfd, wstat; + struct _header_raw *header; + GSList *n, *bcc = NULL; sigset_t mask, omask; CamelStream *out; pid_t pid; - + if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &from_addr)) return FALSE; @@ -115,12 +117,26 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, argv[i + 5] = NULL; + /* copy and remove the bcc headers */ + header = CAMEL_MIME_PART (message)->headers; + while (header) { + if (!strcasecmp (header->name, "Bcc")) + bcc = g_slist_append (bcc, g_strdup (header->value)); + header = header->next; + } + + n = bcc; + while (n) { + camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); + n = n->next; + } + if (pipe (fd) == -1) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Could not create pipe to sendmail: " "%s: mail not sent"), g_strerror (errno)); - return FALSE; + goto exception; } /* Block SIGCHLD so the calling application doesn't notice @@ -139,7 +155,8 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, g_strerror (errno)); sigprocmask (SIG_SETMASK, &omask, NULL); g_free (argv); - return FALSE; + + goto exception; case 0: /* Child process */ nullfd = open ("/dev/null", O_RDWR); @@ -170,7 +187,7 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, sigprocmask (SIG_SETMASK, &omask, NULL); - return FALSE; + goto exception; } camel_object_unref (CAMEL_OBJECT (out)); @@ -181,6 +198,15 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, sigprocmask (SIG_SETMASK, &omask, NULL); + /* add the bcc headers back */ + while (bcc) { + n = bcc->next; + camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data); + g_free (bcc->data); + g_slist_free1 (bcc); + bcc = n; + } + if (!WIFEXITED (wstat)) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("sendmail exited with signal %s: " @@ -203,6 +229,17 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message, } return TRUE; + + exception: + + /* add the bcc headers back */ + while (bcc) { + n = bcc->next; + camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data); + g_free (bcc->data); + g_slist_free1 (bcc); + bcc = n; + } } static char * diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 6361dcd7a8..561ccbc4c5 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -1226,7 +1226,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha CamelStreamFilter *filtered_stream; CamelMimeFilter *crlffilter; struct _header_raw *header; - GSList *h, *bcc = NULL; + GSList *n, *bcc = NULL; int ret; /* if the message contains 8bit/binary mime parts and the server @@ -1290,20 +1290,22 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha header = header->next; } - camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); + n = bcc; + while (n) { + camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc"); + n = n->next; + } /* write the message */ ret = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream)); /* add the bcc headers back */ - if (bcc) { - h = bcc; - while (h) { - camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data); - g_free (h->data); - h = h->next; - } - g_slist_free (bcc); + while (bcc) { + n = bcc->next; + camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data); + g_free (bcc->data); + g_slist_free1 (bcc); + bcc = n; } if (ret == -1) { |