bug-mailutils
[Top][All Lists]
Advanced

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

Re: [bug-mailutils] Re: IMAP protocol violation in 1.1


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Re: IMAP protocol violation in 1.1
Date: Sat, 16 Aug 2008 11:40:09 +0300

Simon Josefsson <address@hidden> ha escrit:

> Excellent!  ... almost.  The LIST command works a bit mysterious.  If I
> have SELECTed INBOX, it appears to work fine,

That is, in that case it worked wrong!

> but not if I have closed
> the mailbox?  Then it seems to list all files in my home directory.

And then it worked correctly.  According to RFC 3501 (section 6.3.8):

      An empty ("" string) reference name argument indicates that the
      mailbox name is interpreted as by SELECT.

SELECT interprets mailbox names according to usual UNIX rules, i.e.
if a name does not have any directory components, it is looked up
in the current working directory, which is always the user home
directory for imap4d.  Therefore `LIST "" "*"' should list the mailboxes
from the user home directory.

The bug is that the LIST behavior may not depend on whether a mailbox
was selected or not. Please, apply the attached patch to fix this bug,
and the bug in FETCH parser you have encountered.

> I think I'm fairly close to getting this up and running, I want a IMAP
> server for my ~/Maildir/ hierarchy, and nothing outside that directory.

This means, in other words, that you wish to change the IMAP's notion of
the user home directory.  The only way to do that currently is by
supplying a custom authorization method.  I'll see if I can supply
another way of doing that.


Regards,
Sergey

Index: imap4d/fetch.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/fetch.c,v
retrieving revision 1.67
diff -p -u -r1.67 fetch.c
--- imap4d/fetch.c      12 Aug 2008 21:26:29 -0000      1.67
+++ imap4d/fetch.c      16 Aug 2008 08:16:07 -0000
@@ -1484,7 +1484,7 @@ parse_fetch_body (struct parsebuf *p)
       parsebuf_next (p, 0);
     }
   else if (parse_body_args (p, 0))
-    parsebuf_exit (p, "Syntax error");
+    append_simple_function (p, "BODY", _frt_bodystructure0);
 }
 
 static int
Index: imap4d/util.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/util.c,v
retrieving revision 1.87
diff -p -u -r1.87 util.c
--- imap4d/util.c       13 Aug 2008 07:15:20 -0000      1.87
+++ imap4d/util.c       16 Aug 2008 08:16:07 -0000
@@ -215,6 +215,9 @@ util_msgset (char *s, size_t ** set, int
        break;
     }                          /* while */
 
+  if (*n == 0)
+    return 0;
+  
   /* For message sets in form X:Y where Y is a not-existing UID greater
      than max UID, replace Y with the max UID in the mailbox */
   if (*n == 1 && invalid_uid)
Index: mailbox/folder.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/mailbox/folder.c,v
retrieving revision 1.39
diff -p -u -r1.39 folder.c
--- mailbox/folder.c    4 Jan 2008 21:49:32 -0000       1.39
+++ mailbox/folder.c    16 Aug 2008 08:16:07 -0000
@@ -494,7 +494,7 @@ is_known_folder (mu_url_t url, mu_folder
          && mu_url_is_same_scheme (url, folder->url)
          && mu_url_is_same_user (url, folder->url)
          && mu_url_is_same_host (url, folder->url)
-         /*&& mu_url_is_same_path (url, folder->url) */
+         && mu_url_is_same_path (url, folder->url) 
          && mu_url_is_same_port (url, folder->url))
        {
          ret = 1;
Index: mailbox/url.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/mailbox/url.c,v
retrieving revision 1.31
diff -p -u -r1.31 url.c
--- mailbox/url.c       28 Dec 2007 15:27:43 -0000      1.31
+++ mailbox/url.c       16 Aug 2008 08:16:07 -0000
@@ -426,10 +426,10 @@ ACCESSOR(is_same,field) (mu_url_t url1, 
   const char *s1, *s2;                                                   \
   int status1, status2;                                                        
  \
                                                                          \
-  status1 = mu_url_sget_scheme (url1, &s1);                              \
+  status1 = ACCESSOR(sget, field) (url1, &s1);                           \
   if (status1 && status1 != MU_ERR_NOENT)                                \
     return 0;                                                            \
-  status2 = mu_url_sget_scheme (url2, &s2);                              \
+  status2 = ACCESSOR(sget, field) (url2, &s2);                           \
   if (status2 && status2 != MU_ERR_NOENT)                                \
     return 0;                                                            \
                                                                          \

reply via email to

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