Message ORGanization Working Group B. Leiba Internet-Draft IBM T.J. Watson Research Center Intended status: Standards Track A. Melnikov Expires: July 27, 2009 Isode Limited January 23, 2009 IMAP4 Multimailbox SEARCH Extension draft-ietf-morg-multimailbox-search-00 Status of this Memo This Internet-Draft is submitted to IETF in full conformance with the provisions of BCP 78 and 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. This Internet-Draft will expire on July 27, 2009. Copyright Notice Copyright (c) 2009 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Abstract The IMAP4 specification allows the searching only of the selected Leiba & Melnikov Expires July 27, 2009 [Page 1] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 mailbox. A user often wants to search multiple mailboxes, and a client that wishes to support this must issue a series of SELECT and SEARCH commands, waiting for each to complete before moving on to the next. This extension allows a client to search multiple mailboxes with one command, limiting the round-trips and waiting for various searches to complete. This also introduces mailbox field in ESEARCH responses, allowing a client to pipeline the searches if it chooses. Note A revised version of this draft document will be submitted to the RFC editor as a Proposed Standard for the Internet Community. Discussion and suggestions for improvement are requested, and should be sent to morg@ietf.org. Table of Contents 1. Conventions used in this document . . . . . . . . . . . . . . . 3 2. Extended SEARCH/UID SEARCH command . . . . . . . . . . . . . . 3 3. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4. Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 5 5. Security Considerations . . . . . . . . . . . . . . . . . . . . 6 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . . 6 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 6 8. Normative References . . . . . . . . . . . . . . . . . . . . . 7 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 7 Leiba & Melnikov Expires July 27, 2009 [Page 2] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 1. Conventions used in this document In examples, "C:" indicates lines sent by a client that is connected to a server. "S:" indicates lines sent by the server to the client. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [Kwds]. 2. Extended SEARCH/UID SEARCH command Arguments: OPTIONAL source options OPTIONAL result options OPTIONAL [CHARSET] specification searching criteria (one or more) Responses: REQUIRED untagged response: SEARCH or ESEARCH Result: OK - search completed NO - search error: cannot search that [CHARSET] or criteria BAD - command unknown or arguments invalid This section further updates definition of the SEARCH command described in section 2.6.1 of [IMAPABNF] (initially described in section 6.4.4 of [RFC3501]. The SEARCH command is extended to allow for optional source and result options. This document does not define any result options. Unless specified otherwise by a description of a result option, presence of a search source option REQUIREs that the server returns ESEARCH responses instead of the corresponding SEARCH responses. Because message numbers are not useful for mailboxes which are not selected, each ESEARCH response MUST return information about UIDs and not message numbers (whether the SEARCH or the UID SEARCH command was issued), in particular it MUST contain the UID indicator. Presence of a source option in absence of a result option implies the "ALL" result option (see [ESEARCH]). [[anchor3: SEARCH with source options is allowed in authenticated state (and not just "selected")!!!]] Source options describe which mailboxes must be searched for messages. (Without the source options only the current mailbox is searched.) Note that a SEARCH/UID SEARCH command with source options Leiba & Melnikov Expires July 27, 2009 [Page 3] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 doesn't affect which mailbox is currently selected and doesn't require any mailbox to be selected. For each mailbox satisfying the source options, a single ESEARCH response MUST be returned. The ESEARCH response MUST contain the MAILBOX correlator in addition to the TAG correlator. Correlators allow clients to issue several SEARCH/UID SEARCH commands at once (pipelined). The server MAY perform those searches in parallel; or it MAY instead serialize them. The source options, if present, MUST contain one or more mailbox list pattern, any one of them can contain the IMAP mailbox wildcard characters. The patterns can be optionally followed by other search source options. Only one such option is defined by this document: "DEPTH". The option "depth " causes the SEARCH command to traverse the hierarchy "n" levels down (including the current level). Thus, mailbox pattern "xyz*" with "depth 2" and mailbox pattern "xyz/*" with "depth 1" will both match child mailboxes of "xyz", but will not match child mailboxes of those children (of course, the former will also match "xyzabc", while the latter will not). If the server supports the ACL [ACL] extension, then the logged in user is required to have the 'r' right for each mailbox she wants to search. Mailboxes matching the source options for which the logged in user has no 'r' right MUST be ignored by a multimailbox search. [[anchor4: Borrow syntax from the recent draft-ietf-lemonade-imap-notify?]] [[anchor5: Interaction with CONTEXT (RFC 5267) needs to be defined. Also, UPDATE option draft-ietf-lemonade-imap-notify might have to be prohibited when both CONTEXT and this extension are used.]] 3. Example C: tag1 SEARCH IN (("folder1" "folder2/*") (depth 1)) unseen C: tag2 SEARCH IN (("folder1" "folder2/*")) subject "chad" S: * ESEARCH (TAG "tag1" mailbox "folder1") UID ALL 4001,4003,4005,4007,4009 S: * ESEARCH (TAG "tag1" mailbox "folder1") UID ALL 195001: 195004,169788 S: * ESEARCH (TAG "tag1" mailbox "folder2/banana") UID ALL 3002,4004 S: * ESEARCH (TAG "tag1" mailbox "folder2/peach") UID ALL 921691 S: tag1 OK done S: * ESEARCH (TAG "tag2" mailbox "folder2/dubya") UID ALL 50003,50006,50009,50012 S: tag2 OK done Leiba & Melnikov Expires July 27, 2009 [Page 4] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 4. Formal Syntax The following syntax specification uses the augmented Backus-Naur Form (BNF) as described in [ABNF]. Terms not defined here are taken from [RFC3501], [LISTEXT] or [IMAPABNF]. [[anchor7: Updates definition in RFC 4466 (added "[search-source-opts]"):]] search = "SEARCH" [search-source-opts] [search-return-opts] SP search-program [[anchor8: Defined in RFC 4466 (updated to reference search-criteria):]] search-program = ["CHARSET" SP charset SP] search-criteria ;; CHARSET argument to SEARCH MUST be ;; registered with IANA. search-source-opts = SP "IN" SP "(" mbox-or-pat [SP "(" scope- options ")"] ")" scope-option = "DEPTH" SP number / scope-option-ext scope-options = scope-option *(SP scope-option) ;; a given option may only appear once scope-option-name = tagged-ext-label scope-option-ext = scope-option-name [SP scope-option-value] scope-option-value= tagged-ext-val ;; This non-terminal shows recommended syntax ;; for future extensions. Leiba & Melnikov Expires July 27, 2009 [Page 5] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 [[anchor9: Also defined in FILTERS:]] search-criteria = search-key *(SP search-key) [[anchor10: Redefining search-correlator from RFC 4466:]] search-correlator = SP "(" single-correlator *(SP single-correlator) ")" [[anchor11: This is a new non-terminal:]] single-correlator = "TAG" SP tag-string / "MAILBOX" SP astring [[anchor12: The following 2 are borrowed from LISTEXT:]] mbox-or-pat = list-mailbox / patterns patterns = "(" list-mailbox *(SP list-mailbox) ")" 5. Security Considerations [[anchor13: TBD]] 6. IANA Considerations IMAP4 capabilities are registered by publishing a standards track or IESG approved experimental RFC. The registry is currently located at: http://www.iana.org/assignments/imap4-capabilities This document defines the X-DRAFT-I03-MMBX [[anchor14: Note to RFC Editor: fix before publication]] IMAP capability. IANA is requested to add it to the registry. 7. Acknowledgements The authors gratefully acknowledge feedback provided by Peter Coates Leiba & Melnikov Expires July 27, 2009 [Page 6] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 and Arnt Gulbrandsen. 8. Normative References [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 5234, January 2008. [ACL] Melnikov, A., "IMAP4 Access Control List (ACL) Extension", RFC 4314. [CHARSET] Freed, N. and J. Postel, "IANA Charset Registration Procedures", RFC 2978, October 2000. [CONTEXT] Cridland, D. and C. King, "Contexts for IMAP4", RFC 5267, 2008. [ESEARCH] Melnikov, A. and D. Cridland, "IMAP4 Extension to SEARCH Command for Controlling What Kind of Information Is Returned", RFC 4731, November 2006. [IMAPABNF] Melnikov, A. and C. Daboo, "Collected Extensions to IMAP4 ABNF", RFC 4466, April 2006. [Kwds] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997. [LISTEXT] Leiba, B. and A. Melnikov, "IMAP4 LIST Command Extensions", RFC 5258, June 2008. [NOTIFY] Melnikov, A., Gulbrandsen, A., and C. King, "The IMAP NOTIFY Extension", draft-ietf-lemonade-imap-notify-07 (work in progress), 2008. [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003. Leiba & Melnikov Expires July 27, 2009 [Page 7] Internet-Draft IMAP4 Multimailbox SEARCH Extension January 2009 Authors' Addresses Barry Leiba IBM T.J. Watson Research Center 19 Skyline Drive Hawthorne, NY 10532 US Phone: +1 914 784 7941 Email: leiba@watson.ibm.com Alexey Melnikov Isode Limited 5 Castle Business Village 36 Station Road Hampton, Middlesex TW12 2BX UK Email: Alexey.Melnikov@isode.com URI: http://www.melnikov.ca/ Leiba & Melnikov Expires July 27, 2009 [Page 8]