[Imap-uw] c-client bug? Content-location datatype - stringlist or char* ?

Mark Crispin MRC at CAC.Washington.EDU
Tue Oct 23 10:57:13 PDT 2007


Thank you for asking.

The implementation in c-client is correct, and your IMAP server is 
incorrect.  I understand how this happened, and to some extent it is my 
fault.

However, the problem is that the author of your IMAP server did not obey 
explicit instructions in RFC 3501.  Specifically, he did not implement 
using the formal syntax, but instead relied upon the descriptive text. 
This is a bad idea, since it causes precisely this type of problem.  RFC 
3501 section 1.1 states that the Formal Syntax is normative and text in 
section 6 and 7 is descriptive.

The text in section 7.4.2 that says "string list" for the body location 
is, indeed, an error in the descriptive text.  This erro has been noted in 
the RFC 3501 errata on the rfc-editor.org web site for some time.  There 
is also a copy of the errata on the UW site:
 	ftp://ftp.cac.washington.edu/mail/imap.rfcs/rfc3501-errata

The Formal Syntax for body-fld-loc in RFC 3501 is correct:

 	body-fld-loc    = nstring

and, as noted above, overrides the incorrect "string list" text in the 
descriptive text in 7.4.2.

At the rest of saying "I told you so", this is why I resisted including 
that level of detail in the descriptive text.  The IMAP specification is a 
very large and complex document written and maintained by fallible human 
beings; and in spite of best efforts such errors have (and WILL) occur. 
Whenever there is more than one place that seems to document something, 
invariably there will be people who choose the wrong place as the 
normative document.  Usually this is alright, as the "other place" matches 
the normative statement; but there is always the exception such as this.

In summary: the Formal Syntax in RFC 3501 section 9, and ONLY the Formal 
Syntax in RFC 3501 section 9, is normative for the IMAP protocol.  Any 
text found elsewhere, includes text in RFC 3501 section 6 or 7, that 
conflicts with the Formal Syntax is in error.

On Tue, 23 Oct 2007, Amit Srivastava wrote:

> Hello All,
>
> I have a query regarding the support of "location" member of the BODY
> structure.
>
> In mail.h its datatype is char*
>
> BODY
> {
> .......
> char *location;		/* body content URI */
> ....
> }
>
> But the RFC3501 says its a *stringlist*.
> <<
> body location
>            A *string list* giving the body content URI as defined in
>            [LOCATION].
>>>
>
> Hence the problem is seen when following code is executed in
> imap4r1.c
>
> body->location = imap_parse_string
> (stream,txtptr,reply,NIL,NIL,LONGT);
>
> I am facing this issue against an imap server with RFC3501
> implementing "content-location" as stringlist.
> e.g.
>
> C: fetch bodystructure
> S: * 1 FETCH (BODYSTRUCTURE (("TEXT" "PLAIN" ("CHARSET" "us-ascii")
>        <SPACE>NIL NIL "7BIT" 323 14 NIL NIL NIL NIL)("TEXT"
> "HTML"<SPACE>
>        ("CHARSET" "iso-8859-1") NIL NIL "QUOTED-PRINTABLE"
> 50578<SPACE>
>               1111 NIL NIL NIL ("http://home.netscape.com/"))<SPACE>
>        "MIXED" ("BOUNDARY"
> "------------8FC7BFAA529B4689FD642892")<SPACE>
>                  NIL NIL NIL))
>
>
> Note the parentheses in ("http://home.netscape.com/") above response.
>
> UW IMAP does not handle '(' and ')' when looking for char*, but it
> does handle this for STRINGLIST datatype.
> Its impact is very high - not able to see attachment.
>
> Am I missing something here or is it a bug in c-client library.
>
>
> Thanks,
> -Amit
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> _______________________________________________
> Imap-uw mailing list
> Imap-uw at u.washington.edu
> https://mailman1.u.washington.edu/mailman/listinfo/imap-uw
>

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


More information about the Imap-uw mailing list