Internet Draft A. Melnikov Document: draft-melnikov-imap-ext-abnf Isode Ltd. Expires: December 2005 Cyrus Daboo ISAMET, Inc. June 2005 Collected extensions to IMAP4 ABNF draft-melnikov-imap-ext-abnf-02 Status of this Memo By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. A revised version of this draft document will be submitted to the RFC editor as a Standard Track RFC for the Internet Community. Discussion and suggestions for improvement are requested, and should be sent to ietf-imapext@imc.org and/or lemonade@ietf.org. Distribution of this memo is unlimited. Abstract Over years many documents from IMAPEXT and LEMONADE working groups, as well as many individual documents have added syntactic extensions to many base IMAP commands described in RFC 3501. For ease of reference this document collects most of such ABNF changes in one place. This document updates ABNF in RFC 3501. Table of Contents 1. Conventions Used in this Document 2 2. IMAP ABNF extensions 3 2.1 Optional parameters with the SELECT/EXAMINE commands 3 2.2 Extensions to FETCH and UID FETCH Commands 4 2.3 Extensions to STORE and UID STORE Commands 4 2.4 Extensions to SEARCH Command 5 2.5 Extensions to APPEND Command 6 3. Formal Syntax 6 4. Security Considerations 9 5. IANA Considerations 9 6. References 9 6.1 Normative References 9 7. Acknowledgments 10 8. Author's Addresses 10 9. Full Copyright Statement 10 10. Intellectual Property 11 11. Appendix A. Editorial. 11 11.1 Change Log 11 1. Conventions Used in this Document In examples, "C:" and "S:" indicate lines sent by the client and server respectively. The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" in this document are to be interpreted as defined in "Key words for use in RFCs to Indicate Requirement Levels" [KEYWORDS]. <> 2. IMAP ABNF extensions 2.1 Optional parameters with the SELECT/EXAMINE commands This documents adds the ability to include one or more parameters with the IMAP SELECT or EXAMINE commands, to turn on or off certain standard behaviour, or to add new optional behaviours required for a particular extension. There are two possible modes of operation: o A global state change where a single use of the optional parameter will effect the session state from that time on, irrespective of subsequent SELECT/EXAMINE commands. o A per-mailbox state change that will effect the session only for the duration of the new selected state. A subsequent SELECT/ EXAMINE without the optional parameter will cancel its effect For the newly selected mailbox. Optional parameters to the SELECT or EXAMINE commands are added as a parenthesised list of atoms or strings, and appear after the mailbox name in the standard SELECT or EXAMINE command. The order of individual parameters is arbitrary. Individual parameters may consist of one or more atoms or strings in a specific order. If a parameter consists of more than one atom or string, it MUST appear in its own parenthesised list. Any parameter not defined by extensions that the server supports MUST be rejected with a BAD response. Example: C: a SELECT INBOX (ANNOTATE) S: ... S: a OK SELECT complete In the above example, a single parameter is used with the SELECT command. Example: C: a EXAMINE INBOX (ANNOTATE (RESPONSES "UID Responses") CONDSTORE) S: ... S: a OK EXAMINE complete In the above example, three parameters are used with the EXAMINE command. The second parameter consists of two items: an atom followed by a quoted string. Example: C: a SELECT INBOX (BLURDYBLOOP) S: a BAD Unknown parameter in SELECT command In the above example, a parameter not supported by the server is used. This results in the BAD response from the server. 2.2 Extensions to FETCH and UID FETCH Commands Arguments: sequence set message data item names or macro OPTIONAL fetch modifiers Responses: untagged responses: FETCH Result: OK - fetch completed NO - fetch error: can't fetch that data BAD - command unknown or arguments invalid This document extends the syntax of the FETCH and UID FETCH commands (see section 6.4.5 of [IMAP4]) to include optional FETCH modifiers. No fetch modifiers are defined in this document. The order of individual modifiers is arbitrary. An individual modifier may consist of one or more atoms or strings in a specific order. If a modifier consists of more than one atom or string, it MUST appear in its own parenthesised list. Any modifiers not defined by extensions that the server supports MUST be rejected with a BAD response. 2.3 Extensions to STORE and UID STORE Commands Arguments: message set OPTIONAL store modifiers message data item name value for message data item Responses: untagged responses: FETCH Result: OK - store completed NO - store error: can't store that data BAD - command unknown or arguments invalid This document extends the syntax of the STORE and UID STORE commands (see section 6.4.6 of [IMAP4]) to include optional STORE modifiers. No store modifiers are defined in this document. The order of individual modifiers is arbitrary. Individual modifier may consist of one or more atoms or strings in a specific order. If a modifier consists of more than one atom or string, it MUST appear in its own parenthesised list. Any modifiers not defined by extensions that the server supports MUST be rejected with a BAD response. 2.4 Extensions to SEARCH Command Arguments: OPTIONAL result specifier OPTIONAL [CHARSET] specification searching criteria (one or more) Responses: REQUIRED untagged response: SEARCH (*) Result: OK - search completed NO - search error: can't search that [CHARSET] or criteria BAD - command unknown or arguments invalid This section updates definition of the SEARCH command described in section 6.4.4 of [IMAP4]. The SEARCH command is extended to allow for result options. This document doesn't define any result option. The order of individual options is arbitrary. Individual options may optionally contain parameters enclosed in parenthesises. If an option has parameters, they consist of one or more atoms or strings in a specific order. Any options not defined by extensions that the server supports MUST be rejected with a BAD response. (*) - An extension to SEARCH command may require another untagged response, or no untagged response to be returned. 2.5 Extensions to APPEND Command The APPEND command is extended to allow the client to append data containing NULs by using the syntax. The ABNF was rewritten to allow for easier extensibility by IMAP extensions. 3. Formal Syntax The following syntax specification uses the Augmented Backus-Naur Form (ABNF) notation as specified in [ABNF]. Non-terminals referenced but not defined below are as defined by [IMAP4]. Except as noted otherwise, all alphabetic characters are case- insensitive. The use of upper or lower case characters to define token strings is for editorial clarity only. Implementations MUST accept these strings in a case-insensitive fashion. append = "APPEND" SP mailbox 1*append-message ;; only a single append-message may appear ;; if MULTIAPPEND [MULTIAPPEND] capability ;; is not present append-message = append-opts SP append-data append-ext = append-opt-name SP append-opt-val append-opt-comp = astring / append-opt-comp *(SP append-opt-comp) / "(" append-opt-comp ")" append-opt-name = atom append-opt-val = astring / "(" append-opt-comp ")" <> append-data = literal / literal8 <> append-opts = [SP flag-list] [SP date-time] *(SP append-ext) examine = "EXAMINE" SP mailbox [select-params] ;; modifies the original IMAP EXAMINE command ;; to accept optional parameters fetch = "FETCH" SP sequence-set SP ("ALL" / "FULL" / "FAST" / fetch-att / "(" fetch-att *(SP fetch-att) ")") [SP fetch-modifiers] ;; modifies the original IMAP4 FETCH command to ;; accept optional modifiers fetch-modifiers = "(" fetch-modifier *(SP fetch-modifier) ")" fetch-modifier = fetch-modifier-name [ SP ( astring / "(" fetch-modif-params ")" ) ] ;; modifiers to FETCH may contain a modifier ;; name followed by zero or more atoms or ;; strings - multiple items are always ;; parenthesised, nesting is allowed <> fetch-modif-params = astring *(SP astring) / "(" fetch-modif-params *(SP fetch-modif-params) ")" <> fetch-modifier-name = atom literal8 = "~{" number "}" CRLF *OCTET ;; A string that might contain NULs. ;; represents the number of OCTETs ;; in the response string. search = "SEARCH" [search-return-opts] [SP "CHARSET" SP astring] 1*(SP search-key) ;; CHARSET argument to SEARCH MUST be ;; registered with IANA search-return-opts = "RETURN" SP "(" [search-return-opt *(SP search-return-opt)] ")" ;; SEARCH return options, e.g. MIN search-return-opt = search-modifier-name [SP search-mod-params] ;; MUST start with atom (label) search-modifier-name = atom search-mod-params = astring / "(" [search-mod-comp] ")" search-mod-comp = astring / search-mod-comp *(SP search-mod-comp) / "(" search-mod-comp ")" ;; same structure as for store-modparam-comp select = "SELECT" SP mailbox [select-params] ;; modifies the original IMAP SELECT command to ;; accept optional parameters select-params = SP "(" select-param *(SP select-param) ")" select-param = astring / "(" astring 1*(SP astring) ")" ;; parameters to SELECT may contain one or ;; more atoms or strings - multiple items ;; are always parenthesised status = "STATUS" SP mailbox SP "(" status-att-req *(SP status-att-req) ")" ;; redefine STATUS command syntax defined in ;; [IMAP4] status-att-list = status-rsp-info *(SP status-rsp-info) ;; Redefines status-att-list from RFC 3501 status-att-req = status-att status-rsp-info = status-att SP number store = "STORE" SP sequence-set store-modifiers SP store-att-flags ;; extend [IMAP4] STORE command syntax ;; to allow for optional store-modifiers store-modifiers = [ SP "(" store-modifier *(SP store-modifier) ")" ] store-modifier = store-modifier-name [SP store-modif-params] ;; MUST start with atom (label) store-modif-params = astring / "(" [store-modparam-comp] ")" store-modparam-comp = astring / store-modparam-comp *(SP store-modparam-comp) / "(" store-modparam-comp ")" <> store-modifier-name = atom <> 4. Security Considerations It is believed that this document doesn't add any new security concerns that were not already identified in RFC 3501. 5. IANA Considerations This document doesn't define any new IMAP extension, so no action from IANA is required. 6. References 6.1 Normative References [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997. [IMAP4] Crispin, M., "Internet Message Access Protocol - Version 4rev1", RFC 3501, University of Washington, March 2003. [ABNF] Crocker, D. (Ed.) and P. Overell , "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997. <> [CHARSET] Freed, N. and J. Postel, "IANA Character Set Registration Procedures", RFC 2978, October 2000. [MULTIAPPEND] Crispin, M., "Internet Message Access Protocol (IMAP) - MULTIAPPEND Extension", RFC 3502, March 2003. 7. Acknowledgments This documents is based on ideas proposed by Pete Resnick, Mark Crispin, Ken Murchison, Philip Guenther, Randall Gellens and Lyndon Nerenberg. However all errors and omissions must be attributed to the authors of the document. Some text was borrowed from draft-ietf-imapext-annotate-12.txt. literal8 syntax was taken verbatim from RFC 3516. 8. Author's Addresses Alexey Melnikov Isode Limited 5 Castle Business Village 36 Station Road Hampton, Middlesex, TW12 2BX UK Email: Alexey.Melnikov@isode.com Cyrus Daboo ISAMET, Inc. 5001 Baum Blvd. Suite 650 Pittsburgh, PA 15213 US EMail: daboo@isamet.com 9. Full Copyright Statement Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 10. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf- ipr@ietf.org. Acknowledgement Funding for the RFC Editor function is currently provided by the Internet Society. 11. Appendix A. Editorial. <> 11.1 Change Log 00 Initial Revision. 01 Added Cyrus as co-author. Added BINARY literals. Added section about APPEND. Clarified that the order of all parameters/modifiers is arbitrary. Unrecognized SELECT/EXAMINE parameter should cause the BAD, not the NO response. 02 Updated boilerplate. Extended SEARCH modifiers to be consistent with STORE modifiers. Rewrote FETCH modifier syntax for consistency.