]> granicus.if.org Git - mutt/commitdiff
More IMAP fixes from Brendan.
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 3 Aug 2000 08:00:44 +0000 (08:00 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 3 Aug 2000 08:00:44 +0000 (08:00 +0000)
imap/BUGS
imap/auth_sasl.c
imap/imap.c
imap/imap_ssl.c
mutt_sasl.c

index 1aa70b1f2eb8e749e141c6361e2e4390c7480fc5..cb27ba9e30825dd7ca84ab7dba772b962d9664fa 100644 (file)
--- a/imap/BUGS
+++ b/imap/BUGS
@@ -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
index 215c128b644a9fb801fbccc2b71e03af54f5ba15..8b78151ca0438b9eef232ad70bd9fdad2fdb39de 100644 (file)
@@ -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;
 
index 991e300c92d443bfd7a0a97ef24bf998a1578def..ca66b2f46527f7cc9ff09f8aa5f46b9ecd095437 100644 (file)
@@ -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)
index 1a97499ebfbf8b9bf8db08c33d5abd50eee76789..c16439863f20b3855fb9d29803bec65461db9304 100644 (file)
@@ -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));
 }
 
index b02b5a2fc7bfdb3a62c878e43e49df52e0fd6aa6..30764a6fe6f8cd1fccc5a3105c2d7ef94e179378 100644 (file)
@@ -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))