aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/smtp
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/smtp')
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 2d07a26b85..c081bd9a13 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -746,20 +746,24 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
}
g_free (cmdbuf);
- /* get the base64 encoded server challenge which should follow a 334 code */
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
- if (!respbuf || strncmp (respbuf, "334", 3)) {
- g_free (respbuf);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("AUTH request timed out: %s"),
- g_strerror (errno));
- goto lose;
- }
while (!camel_sasl_authenticated (sasl)) {
- if (!respbuf)
+ if (!respbuf) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("AUTH request timed out: %s"),
+ g_strerror (errno));
goto lose;
+ }
+
+ /* the server challenge/response should follow a 334 code */
+ if (strcmp (respbuf, "334")) {
+ g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("AUTH request failed."));
+ goto lose;
+ }
/* eat whtspc */
for (challenge = respbuf + 4; isspace (*challenge); challenge++);