IMAP Extensions Working Group                                   B. Leiba
Internet-Draft                           IBM T.J. Watson Research Center
Intended status: Standards Track                             A. Melnikov
Expires: October 24, 2008                                  Isode Limited
                                                          April 22, 2008


                  IMAP4 Multimailbox SEARCH Extension
             draft-melnikov-imapext-multimailbox-search-03

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.

   This Internet-Draft will expire on October 24, 2008.

Abstract

   The IMAP4 specification allows the searching only of the selected
   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.






Leiba & Melnikov        Expires October 24, 2008                [Page 1]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


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
   ietf-imapext@imc.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
       Intellectual Property and Copyright Statements  . . . . . . . . 9























Leiba & Melnikov        Expires October 24, 2008                [Page 2]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


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 words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" are
   used in this document as specified 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
   doesn't affect which mailbox is currently selected and doesn't



Leiba & Melnikov        Expires October 24, 2008                [Page 3]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


   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 <n>" 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
   (draft-cridland-imap-context-05.txt) 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 October 24, 2008                [Page 4]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


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 October 24, 2008                [Page 5]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


               [[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 October 24, 2008                [Page 6]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


   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.

   [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", draft-ietf-imapext-list-extensions-18 (work
              in progress), 2006.

   [RFC3501]  Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
              4rev1", RFC 3501, March 2003.


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








Leiba & Melnikov        Expires October 24, 2008                [Page 7]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


   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 October 24, 2008                [Page 8]


Internet-Draft     IMAP4 Multimailbox SEARCH Extension        April 2008


Full Copyright Statement

   Copyright (C) The IETF Trust (2008).

   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, THE IETF TRUST 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.


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.











Leiba & Melnikov        Expires October 24, 2008                [Page 9]