aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-10-08 02:13:53 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-10-08 02:13:53 +0800
commit3b8bf37f68a98dd16412370aea4be4cf4f31aa2b (patch)
tree939ca75b3feee30a3029de3edae8854eca7377c3 /camel
parentbf304afc8a019174580a7ee60058662f4082a207 (diff)
downloadgsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar.gz
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar.bz2
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar.lz
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar.xz
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.tar.zst
gsoc2013-evolution-3b8bf37f68a98dd16412370aea4be4cf4f31aa2b.zip
Fixes bug #31752
2002-10-07 Jeffrey Stedfast <fejj@ximian.com> Fixes bug #31752 * providers/smtp/camel-smtp-transport.c (connect_to_server): Don't forget to send another EHLO command to the server once we toggle into STARTTLS mode. (smtp_helo): Reset any flags set using the EHLO response and also any authtypes. svn path=/trunk/; revision=18334
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog12
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c37
-rw-r--r--camel/providers/smtp/camel-smtp-transport.h2
3 files changed, 39 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 68f63ef12a..1290a4c348 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,17 @@
+2002-10-07 Jeffrey Stedfast <fejj@ximian.com>
+
+ Fixes bug #31752
+
+ * providers/smtp/camel-smtp-transport.c (connect_to_server): Don't
+ forget to send another EHLO command to the server once we toggle
+ into STARTTLS mode.
+ (smtp_helo): Reset any flags set using the EHLO response and also
+ any authtypes.
+
2002-10-06 Jeffrey Stedfast <fejj@ximian.com>
+ Fixes bug #31681
+
* camel-mime-utils.c: Fix all mailing list regex patterns to allow
any number of spaces *or* tabs as pre-padding for the header
values.
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 8b84c29354..03e7d03bd6 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -245,11 +245,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
return FALSE;
/* set some smtp transport defaults */
- transport->flags &= ~(CAMEL_SMTP_TRANSPORT_IS_ESMTP |
- CAMEL_SMTP_TRANSPORT_8BITMIME |
- CAMEL_SMTP_TRANSPORT_STARTTLS |
- CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES);
-
+ transport->flags &= CAMEL_SMTP_TRANSPORT_USE_SSL; /* reset all but ssl flags */
transport->authtypes = NULL;
port = service->url->port ? service->url->port : SMTP_PORT;
@@ -377,15 +373,22 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
} while (*(respbuf+3) == '-'); /* if we got "220-" then loop again */
/* Okay, now toggle SSL/TLS mode */
- ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
- if (ret != -1)
- return TRUE;
+ if (camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream)) == -1) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Failed to connect to SMTP server %s in secure mode: %s"),
+ service->url->host, g_strerror (errno));
+ goto exception_cleanup;
+ }
+
+ /* We are supposed to re-EHLO after a successful STARTTLS to
+ re-fetch any supported extensions. */
+ if (!smtp_helo (transport, ex) && !transport->connected)
+ return FALSE;
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to SMTP server %s in secure mode: %s"),
- service->url->host, g_strerror (errno));
+ return TRUE;
exception_cleanup:
+
camel_object_unref (CAMEL_OBJECT (transport->istream));
transport->istream = NULL;
camel_object_unref (CAMEL_OBJECT (transport->ostream));
@@ -863,6 +866,18 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
const char *token;
int af;
+ /* these are flags that we set, so unset them in case we
+ are being called a second time (ie, after a STARTTLS) */
+ transport->flags &= ~(CAMEL_SMTP_TRANSPORT_8BITMIME |
+ CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES |
+ CAMEL_SMTP_TRANSPORT_STARTTLS);
+
+ if (transport->authtypes) {
+ g_hash_table_foreach (transport->authtypes, authtypes_free, NULL);
+ g_hash_table_destroy (transport->authtypes);
+ transport->authtypes = NULL;
+ }
+
camel_operation_start_transient (NULL, _("SMTP Greeting"));
/* get the local host name */
diff --git a/camel/providers/smtp/camel-smtp-transport.h b/camel/providers/smtp/camel-smtp-transport.h
index 9874eb09c3..ef15f2b07d 100644
--- a/camel/providers/smtp/camel-smtp-transport.h
+++ b/camel/providers/smtp/camel-smtp-transport.h
@@ -30,7 +30,7 @@
#ifdef __cplusplus
extern "C" {
#pragma }
-#endif /* __cplusplus }*/
+#endif /* __cplusplus */
#include "camel-transport.h"