From 1d0160ac11ca74d21207f4c51fe57028d3c12dee Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 13 Mar 2002 23:44:29 +0000 Subject: Added a work-around for SMTP servers that can't read the RFCs and thus 2002-03-13 Jeffrey Stedfast * providers/smtp/camel-smtp-transport.c (smtp_auth): Added a work-around for SMTP servers that can't read the RFCs and thus implement SASL incorrectly. Oh well, that's life in the world of mail clients I guess. svn path=/trunk/; revision=16152 --- camel/providers/smtp/camel-smtp-transport.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'camel/providers/smtp/camel-smtp-transport.c') diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 0c331bb673..d0b257cd6b 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -970,6 +970,7 @@ static gboolean smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) { char *cmdbuf, *respbuf = NULL, *challenge; + gboolean auth_challenge = FALSE; CamelSasl *sasl = NULL; camel_operation_start_transient (NULL, _("SMTP Authentication")); @@ -984,10 +985,12 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) challenge = camel_sasl_challenge_base64 (sasl, NULL, ex); if (challenge) { + auth_challenge = TRUE; cmdbuf = g_strdup_printf ("AUTH %s %s\r\n", mech, challenge); g_free (challenge); - } else + } else { cmdbuf = g_strdup_printf ("AUTH %s\r\n", mech); + } d(fprintf (stderr, "sending : %s", cmdbuf)); if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) { @@ -1018,6 +1021,15 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) goto lose; } + if (FALSE) { + broken_smtp_server: + d(fprintf (stderr, "Your SMTP server's implementation of the %s SASL\n" + "authentication mechanism is broken. Please report this to the\n" + "appropriate vendor and suggest that they re-read rfc2222 again\n" + "for the first time (specifically Section 4, paragraph 2).\n", + mech)); + } + /* eat whtspc */ for (challenge = respbuf + 4; isspace (*challenge); challenge++); @@ -1043,6 +1055,10 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) /* check that the server says we are authenticated */ if (!respbuf || strncmp (respbuf, "235", 3)) { + if (respbuf && auth_challenge && !strncmp (respbuf, "334", 3)) { + /* broken server, but lets try and work around it anyway... */ + goto broken_smtp_server; + } g_free (respbuf); goto lose; } -- cgit v1.2.3