aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-07-17 03:50:17 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-07-17 03:50:17 +0800
commit9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c (patch)
tree95e8d418ffb02dacf927a273b9486ef1e022720c
parent21bc75bf4529ed813e3513c7b88656ca9b904f62 (diff)
downloadgsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar.gz
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar.bz2
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar.lz
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar.xz
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.tar.zst
gsoc2013-evolution-9f421a0b1cbed4440e623adf47ecf8a5c7aeaf0c.zip
Make the standard AUTH format take priority over the AUTH= priority, since
2002-07-16 Jeffrey Stedfast <fejj@ximian.com> * providers/smtp/camel-smtp-transport.c (smtp_helo): Make the standard AUTH format take priority over the AUTH= priority, since sometimes servers only list a subset of the supported authtypes in the AUTH= response while they list all authtypes in the standard AUTH response. Fixes "bug" #27841. svn path=/trunk/; revision=17479
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c51
-rw-r--r--camel/providers/smtp/camel-smtp-transport.h2
3 files changed, 43 insertions, 18 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 2c592350c8..4eb8fed1a4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,11 @@
+2002-07-16 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/smtp/camel-smtp-transport.c (smtp_helo): Make the
+ standard AUTH format take priority over the AUTH= priority, since
+ sometimes servers only list a subset of the supported authtypes in
+ the AUTH= response while they list all authtypes in the standard
+ AUTH response. Fixes "bug" #27841.
+
2002-07-15 Peter Williams <peterw@ximian.com>
* providers/imap/camel-imap-folder.c (imap_get_message): If we're
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index bc188ad6cf..363c5ecc1f 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -534,12 +534,10 @@ smtp_connect (CamelService *service, CamelException *ex)
return TRUE;
}
-static gboolean
+static void
authtypes_free (gpointer key, gpointer value, gpointer data)
{
g_free (value);
-
- return TRUE;
}
static gboolean
@@ -560,7 +558,7 @@ smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex)
return FALSE;
if (transport->authtypes) {
- g_hash_table_foreach_remove (transport->authtypes, authtypes_free, NULL);
+ g_hash_table_foreach (transport->authtypes, authtypes_free, NULL);
g_hash_table_destroy (transport->authtypes);
transport->authtypes = NULL;
}
@@ -569,7 +567,7 @@ smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex)
camel_object_unref (CAMEL_OBJECT (transport->istream));
transport->ostream = NULL;
transport->istream = NULL;
-
+
camel_tcp_address_free (transport->localaddr);
transport->localaddr = NULL;
@@ -907,19 +905,36 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
} else if (!strncmp (token, "STARTTLS", 8)) {
d(fprintf (stderr, "This server supports STARTTLS\n"));
transport->flags |= CAMEL_SMTP_TRANSPORT_STARTTLS;
- } else if (!transport->authtypes && !strncmp (token, "AUTH", 4)) {
- /* Don't bother parsing any authtypes if we already have a list.
- * Some servers will list AUTH twice, once the standard way and
- * once the way Microsoft Outlook requires them to be:
- *
- * 250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5
- * 250-AUTH=LOGIN PLAIN DIGEST-MD5 CRAM-MD5
- **/
-
- /* parse for supported AUTH types */
- token += 5;
-
- transport->authtypes = esmtp_get_authtypes (token);
+ } else if (!strncmp (token, "AUTH", 4)) {
+ if (!transport->authtypes || transport->flags & CAMEL_SMTP_TRANSPORT_AUTH_EQUAL) {
+ /* Don't bother parsing any authtypes if we already have a list.
+ * Some servers will list AUTH twice, once the standard way and
+ * once the way Microsoft Outlook requires them to be:
+ *
+ * 250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5
+ * 250-AUTH=LOGIN PLAIN DIGEST-MD5 CRAM-MD5
+ *
+ * Since they can come in any order, parse each list that we get
+ * until we parse an authtype list that does not use the AUTH=
+ * format. We want to let the standard way have priority over the
+ * broken way.
+ **/
+
+ if (token[4] == '=')
+ transport->flags |= CAMEL_SMTP_TRANSPORT_AUTH_EQUAL;
+ else
+ transport->flags &= ~CAMEL_SMTP_TRANSPORT_AUTH_EQUAL;
+
+ /* parse for supported AUTH types */
+ token += 5;
+
+ if (transport->authtypes) {
+ g_hash_table_foreach (transport->authtypes, authtypes_free, NULL);
+ g_hash_table_destroy (transport->authtypes);
+ }
+
+ transport->authtypes = esmtp_get_authtypes (token);
+ }
}
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
diff --git a/camel/providers/smtp/camel-smtp-transport.h b/camel/providers/smtp/camel-smtp-transport.h
index 907906c82b..0a57213c8d 100644
--- a/camel/providers/smtp/camel-smtp-transport.h
+++ b/camel/providers/smtp/camel-smtp-transport.h
@@ -53,6 +53,8 @@ extern "C" {
#define CAMEL_SMTP_TRANSPORT_USE_SSL (CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS | \
CAMEL_SMTP_TRANSPORT_USE_SSL_WHEN_POSSIBLE)
+#define CAMEL_SMTP_TRANSPORT_AUTH_EQUAL (1 << 6) /* set if we are using authtypes from a broken AUTH= */
+
typedef struct {
CamelTransport parent_object;