Commit dce9662a authored by Thomas Roessler's avatar Thomas Roessler

More IMAP fixes from Brendan.

parent b754aa99
......@@ -19,12 +19,6 @@ In no particular order:
Tommi Komulainen's keepalive patch for edit sessions may work for you,
though. Committed to CVS late November 1999, I think.
* Sometimes hdr->env seems to be NULL, according to other users' core
files. I haven't been able to reproduce this, and am not sure how
to track it down. But it's very naughty indeed. It appears to be the
result of spurious mx_close_mailbox calls handling the untagged
BYE response.
* Mutt is uninterruptible during socket calls. We should handle SIGINT.
* Server copy currently doesn't take into account uncommitted changes in
......@@ -37,4 +31,4 @@ In no particular order:
* The mutt_pretty routines don't work well when the delimiter isn't '/'.
Brendan Cully <brendan@kublai.com>
Updated 20000719
Updated 20000731
......@@ -70,7 +70,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata)
rc = sasl_client_start (saslconn, idata->capstr, NULL, NULL, &pc, &olen,
&mech);
client_start = (pc != NULL);
client_start = (olen > 0);
if (rc != SASL_OK && rc != SASL_CONTINUE)
{
......@@ -92,30 +92,43 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata)
goto bail;
if (!mutt_strncmp (buf, "+ ", 2))
{
if (sasl_decode64 (buf+2, strlen (buf+2), buf, &len) != SASL_OK)
{
dprint (1, (debugfile, "imap_auth_sasl: error base64-decoding server response.\n"));
goto bail;
}
}
else if ((buf[0] == '*'))
{
if (imap_handle_untagged (idata, buf))
goto bail;
else continue;
}
if (!client_start)
rc = sasl_client_step (saslconn, buf, len, NULL, &pc, &olen);
client_start = 0;
else
client_start = 0;
if (olen)
/* send out response, or line break if none needed */
if (olen && sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK)
{
dprint (1, (debugfile, "imap_auth_sasl: error base64-encoding client response.\n"));
goto bail;
}
if (olen || rc == SASL_CONTINUE)
{
/* send out response, or line break if none needed */
if (sasl_encode64 (pc, olen, buf, sizeof (buf), &olen) != SASL_OK)
{
dprint (1, (debugfile, "imap_auth_sasl: error base64-encoding client response.\n"));
goto bail;
}
strfcpy (buf + olen, "\r\n", sizeof (buf) - olen);
mutt_socket_write (idata->conn, buf);
}
}
while (mutt_strncmp (buf, idata->seq, SEQLEN))
if (mutt_socket_readln (buf, sizeof (buf), idata->conn) < 0)
goto bail;
if (rc != SASL_OK)
goto bail;
......
......@@ -168,6 +168,7 @@ int imap_read_literal (FILE* fp, IMAP_DATA* idata, long bytes)
return -1;
}
#if 1
if (r == 1 && c != '\n')
fputc ('\r', fp);
......@@ -178,7 +179,7 @@ int imap_read_literal (FILE* fp, IMAP_DATA* idata, long bytes)
}
else
r = 0;
#endif
fputc (c, fp);
#ifdef DEBUG
if (debuglevel >= IMAP_LOG_LTRL)
......
......@@ -190,7 +190,6 @@ int ssl_socket_read (CONNECTION * conn)
int ssl_socket_write (CONNECTION * conn, const char *buf)
{
sslsockdata *data = conn->sockdata;
dprint (1, (debugfile, "ssl_socket_write():%s", buf));
return SSL_write (data->ssl, buf, mutt_strlen (buf));
}
......
......@@ -25,7 +25,7 @@
#include <sasl.h>
static sasl_callback_t mutt_sasl_callbacks[3];
static sasl_callback_t mutt_sasl_callbacks[4];
/* callbacks */
static int mutt_sasl_cb_log (void* context, int priority, const char* message);
......@@ -81,6 +81,11 @@ sasl_callback_t* mutt_sasl_get_callbacks (ACCOUNT* account)
callback->context = account;
callback++;
callback->id = SASL_CB_USER;
callback->proc = mutt_sasl_cb_authname;
callback->context = account;
callback++;
callback->id = SASL_CB_PASS;
callback->proc = mutt_sasl_cb_pass;
callback->context = account;
......@@ -101,7 +106,8 @@ static int mutt_sasl_cb_log (void* context, int priority, const char* message)
return SASL_OK;
}
/* mutt_sasl_cb_authname: callback to retrieve authname from ACCOUNT */
/* mutt_sasl_cb_authname: callback to retrieve authname or user (mutt
* doesn't distinguish, even if some SASL plugins do) from ACCOUNT */
static int mutt_sasl_cb_authname (void* context, int id, const char** result,
unsigned* len)
{
......@@ -114,7 +120,8 @@ static int mutt_sasl_cb_authname (void* context, int id, const char** result,
if (!account)
return SASL_BADPARAM;
dprint (2, (debugfile, "mutt_sasl_cb_authname: getting user for %s:%u\n",
dprint (2, (debugfile, "mutt_sasl_cb_authname: getting %s for %s:%u\n",
id == SASL_CB_AUTHNAME ? "authname" : "user",
account->host, account->port));
if (mutt_account_getuser (account))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment