bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] Bugs in mailutils with IMAP folders


From: Thomas Guyot-Sionnest
Subject: [bug-mailutils] Bugs in mailutils with IMAP folders
Date: Wed, 07 Jan 2009 15:50:48 -0500
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Hy there,

I'm trying to move mails from some IMAP folders to an MBOX. None of the
release version of mailutils worked so I started looking at the problem...

v. 1.x:
  I can download the default folder (INBOX).
  It fails if I specify an IMAP folder.

The problem is that it doesn't quote the folder in the SELECT/EXAMINE
command.

imap-1.patch should apply fine on it (though I diff'ed using 2.0). With
that change v. 1.2 works successfully.



v. 2.x:
  Default folder: Cannot append message 1: Cannot allocate memory
  If I specify a folder: Parse Error


Although likely a bad idea to do in general cases, imap-2.patch fix the
parse error. I then get a "Invalid Argument" error.

NB: You don't need an imap server to test this patch.


I couldn't manage to follow the ACCESSOR flow, but I understood that
there was something wrong with it. In imap-3.patch I manually override
the results:

Since there was sensitive information I used tags in the hardcoded data.
Here's a dummy example (adjust it according to the server you're testing
against):

[imap_uri] = imap://user:address@hidden/Public Folders/Test
[uri_path] = Public Folders/Test

Now, with this patch I get the same error as v1.x. Applying the
imap-1.patch then gets me to the "Cannot allocate memory" error. just
like when using the default directory.

NB: If you don't have an IMAP server, just check that the url with path
gets back with the correct rc and full uri in fname


I didn't investigate the last error as I could use v.1.2 and the -2 and
-3 patches are just ugly hacks.

Thanks

--
Thomas
diff -ur mailutils-2.0-orig/libproto/imap/mbox.c 
mailutils-2.0/libproto/imap/mbox.c
--- mailutils-2.0-orig/libproto/imap/mbox.c     2008-12-08 11:06:08.000000000 
-0800
+++ mailutils-2.0/libproto/imap/mbox.c  2009-01-07 12:09:11.000000000 -0800
@@ -682,7 +682,7 @@
   switch (f_imap->state)
     {
     case IMAP_NO_STATE:
-      status = imap_writeline (f_imap, "g%s %s %s\r\n",
+      status = imap_writeline (f_imap, "g%s %s \"%s\"\r\n",
                               mu_umaxtostr (0, f_imap->seq++), 
                                MBX_WRITABLE(mailbox) ? "SELECT" : "EXAMINE",
                                m_imap->name);
diff -ur mailutils-2.0-orig/mailbox/url.c mailutils-2.0/mailbox/url.c
--- mailutils-2.0-orig/mailbox/url.c    2008-12-08 11:06:08.000000000 -0800
+++ mailutils-2.0/mailbox/url.c 2009-01-07 11:42:24.000000000 -0800
@@ -358,9 +358,10 @@
   else
     {
       /* Parse out the SCHEME. */
+printf("DBG: %s\n", name);
       p = strchr (name, ':');
       if (p == NULL)
-       return MU_ERR_PARSE;
+       return 0;//MU_ERR_PARSE;
 
       *p++ = 0;
 
diff -ur mailutils-2.0-orig/mailbox/mailbox.c mailutils-2.0/mailbox/mailbox.c
--- mailutils-2.0-orig/mailbox/mailbox.c        2008-12-08 11:06:08.000000000 
-0800
+++ mailutils-2.0/mailbox/mailbox.c     2009-01-07 12:02:01.000000000 -0800
@@ -51,11 +51,23 @@
   int rc;
   char *fname;
 
-  if ((rc = mu_url_aget_path (mbox->url, &fname)))
+printf("*** MFC0: %s\n", name);
+//  if ((rc = mu_url_aget_path (mbox->url, &fname)))
+  rc = mu_url_aget_path (mbox->url, &fname);
+  if (rc || strcmp(" [imap_uri] ", name) == 0)
     {
+printf("*** MFC0.4: %i, %s, %s\n", rc, mbox->url->name, fname);
+      if (!strcmp(fname, " [uri_path] "))
+        {
+           fname = " [imap_uri] ";
+           rc = MU_ERR_NOENT;
+        }
+printf("*** MFC0.5: %i, %s, %s\n", rc, mbox->url->name, fname);
       if (rc == MU_ERR_NOENT)
        {
+printf("*** MFC1: %i\n", rc);
          fname = strdup (mu_url_to_string (mbox->url));
+printf("*** MFC2: %s\n", fname);
          if (!fname)
            return ENOMEM;
        }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]