idnits 2.17.1 draft-ietf-lemonade-rfc2192bis-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 16. -- Found old boilerplate from RFC 3978, Section 5.5 on line 1217. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 1188. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 1195. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 1201. ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing document type: Expected "INTERNET-DRAFT" in the upper left hand corner of the first page ** The document is more than 15 pages and seems to lack a Table of Contents. == The page length should not exceed 58 lines per page, but there was 26 longer pages, the longest (page 2) being 60 lines == It seems as if not all pages are separated by form feeds - found 0 form feeds but 27 pages -- Found 27 instances of the string 'FORMFEED[Page...' -- is this a case of missing nroff postprocessing? Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an Introduction section. ** There are 2 instances of too long lines in the document, the longest one being 2 characters in excess of 72. ** The abstract seems to contain references ([IMAP4]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (May 2006) is 6548 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'URLAUTH' is mentioned on line 445, but not defined == Missing Reference: 'This RFC' is mentioned on line 838, but not defined -- Looks like a reference, but probably isn't: '256' on line 1063 -- Looks like a reference, but probably isn't: '6' on line 967 == Unused Reference: 'KEYWORDS' is defined on line 844, but no explicit reference was found in the text ** Obsolete normative reference: RFC 3501 (ref. 'IMAP4') (Obsoleted by RFC 9051) -- No information found for draft-melnikov-imap-ext-abnf-XX - is the name correct? -- Possible downref: Normative reference to a draft: ref. 'IMAPABNF' ** Obsolete normative reference: RFC 4234 (ref. 'ABNF') (Obsoleted by RFC 5234) -- No information found for draft-ietf-sasl-anon-XX - is the name correct? -- Possible downref: Normative reference to a draft: ref. 'ANONYMOUS' -- No information found for draft-ietf-lemonade-burl-XX - is the name correct? -- No information found for draft-ietf-lemonade-cate-nate-XX - is the name correct? -- Obsolete informational reference (is this intentional?): RFC 2222 (ref. 'SASL') (Obsoleted by RFC 4422, RFC 4752) Summary: 10 errors (**), 0 flaws (~~), 6 warnings (==), 18 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Newman 3 Document: draft-ietf-lemonade-rfc2192bis-02.txt Sun Microsystems 4 Expires: November 2006 A. Melnikov 5 Intended category: Standards Track Isode Ltd. 6 S. H. Maes 7 Oracle Corporation 8 May 2006 10 IMAP URL Scheme 12 Status of this Memo 13 By submitting this Internet-Draft, each author represents that any 14 applicable patent or other IPR claims of which he or she is aware 15 have been or will be disclosed, and any of which he or she becomes 16 aware will be disclosed, in accordance with Section 6 of BCP 79. 18 Internet-Drafts are working documents of the Internet Engineering 19 Task Force (IETF), its areas, and its working groups. Note that 20 other groups may also distribute working documents as Internet-Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six 23 months and may be updated, replaced, or obsoleted by other documents 24 at any time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as "work in progress". 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 A revised version of this draft document will be submitted to the RFC 34 editor as a Proposed Standard for the Internet Community. Discussion 35 and suggestions for improvement are requested, and should be sent to 36 the IMAPEXT Mailing list . Distribution of this 37 draft is unlimited. 39 Copyright Notice 41 Copyright (C) The Internet Society (2006). 43 Abstract 44 IMAP [IMAP4] is a rich protocol for accessing remote message 45 stores. It provides an ideal mechanism for accessing public mail- 46 ing list archives as well as private and shared message stores. 47 This document defines a URL scheme for referencing objects on an 48 IMAP server. 50 1. Conventions used in this document 52 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 53 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in 54 this document are to be interpreted as described in RFC 2119. 56 2. IMAP scheme 58 The IMAP URL scheme is used to designate IMAP servers, mailboxes, 59 messages, MIME bodies [MIME], and search programs on Internet hosts 60 accessible using the IMAP protocol. 62 The IMAP URL follows the common Internet scheme syntax as defined 63 in [URI-GEN] <>. If : is omitted, the port defaults to 143. 66 An IMAP URL takes one of the following forms: 68 imap:/// 70 imap:///;TYPE= 72 imap:///[uidvalidity][?] 74 imap:///[uidvalidity] 75 [isection][ipartial] 77 The first form is used to refer to an IMAP server, the second form 78 refers to a list of mailboxes, the third form refers to the con- 79 tents of a mailbox or a set of messages resulting from a search, 80 and the final form refers to a specific message or message part, 81 and possibly a byte range in that part. Note that the syntax here 82 is informal. The authoritative formal syntax for IMAP URLs is 83 defined in section 11. The partial specifier semantics conforms to 84 [IMAP4] partial specifiers. 86 3. IMAP userinfo component 87 3.1. IMAP mailbox naming scope 89 The "enc-user" part of the "iuserinfo" component, if present, 90 denotes mailbox naming scope. If it is absent, the IMAP URL can 91 only reference mailboxes with globally unique names, i.e. mailboxes 92 with names that don't change depending on the user the client 93 authenticated as to the IMAP server. <> 96 For example, a personal mailbox described by the following URL 97 is most likely be different 98 from a personal mailbox described by 99 , even though both URLs use the 100 same mailbox name. 102 <> 108 3.2. IMAP User Name and Authentication Mechanism 110 The userinfo component [URI-GEN] of an IMAP URI may contains an 111 IMAP user Name (a.k.a. authorization identity [SASL], "enc-user") 112 and/or an authentication mechanism. (Note that the "enc-user" also 113 defines a mailbox naming scope as described in section 3.1). They 114 are used in the "LOGIN" or "AUTHENTICATE" commands after making the 115 connection to the IMAP server. 117 If no user name or authentication mechanism is supplied, the client 118 must authenticate as anonymous to the server. If the server adver- 119 tises AUTH=ANONYMOUS IMAP capability, the client MUST use the 120 AUTHENTICATE command with ANONYMOUS [ANONYMOUS] SASL mechanism. If 121 SASL ANONYMOUS is not available, the user name "anonymous" is used 122 with the "LOGIN" command and the password is supplied as the Inter- 123 net e-mail address of the end user accessing the resource. The lat- 124 ter option is given in order to provide for interoperability with 125 deployed servers. 127 If the URL doesn't supply a user name, the program interpreting the 128 IMAP URL SHOULD request one from the user (if it is an interactive 129 program) or configuration. 131 Note that as described in RFC 3501, the LOGIN command MUST NOT be 132 used when the IMAP server advertises the LOGINDISABLED capability. 134 An authentication mechanism can be expressed by adding ";AUTH=" to the end of the user name. When such an is indicated, the client SHOULD request appropriate creden- 137 tials from that mechanism and use the "AUTHENTICATE" command 138 instead of the "LOGIN" command. If no user name is specified, one 139 SHOULD be obtained from the mechanism or requested from the user as 140 appropriate. 142 The string ";AUTH=*" indicates that the client SHOULD select an 143 appropriate authentication mechanism. It MAY use any mechanism 144 listed in the response to the CAPABILITY command (or CAPABILITY 145 response code) or use an out of band security service resulting in 146 a PREAUTH connection. If no user name is specified and no appro- 147 priate authentication mechanisms are available, the client SHOULD 148 fall back to anonymous login as described above. This allows a URL 149 which grants read-write access to authorized users, and read-only 150 anonymous access to other users. 152 If a user name is included with no authentication mechanism, then 153 ";AUTH=*" is assumed. 155 Since URLs can easily come from untrusted sources, care must be 156 taken when resolving a URL which requires or requests any sort of 157 authentication. If authentication credentials are supplied to the 158 wrong server, it may compromise the security of the user's account. 159 The program resolving the URL should make sure it meets at least 160 one of the following criteria in this case: 162 (1) The URL comes from a trusted source, such as a referral server 163 which the client has validated and trusts according to site policy. 164 Note that user entry of the URL may or may not count as a trusted 165 source, depending on the experience level of the user and site pol- 166 icy. 167 (2) Explicit local site policy permits the client to connect to the 168 server in the URL. For example, if the client knows the site 169 domain name, site policy may dictate that any hostname ending in 170 that domain is trusted. 171 (3) The user confirms that connecting to that domain name with the 172 specified credentials and/or mechanism is permitted. 173 (4) A mechanism is used which validates the server before passing 174 potentially compromising client credentials. 175 (5) An authentication mechanism is used which will not reveal 176 information to the server which could be used to compromise future 177 connections. 179 URLs which do not include a user name must be treated with extra 180 care, since they are more likely to compromise the user's primary 181 account. A URL containing ";AUTH=*" must also be treated with 182 extra care since it might fall back on a weaker security mechanism. 184 Finally, clients are discouraged from using a plain text password 185 as a fallback with ";AUTH=*" unless the connection has strong 186 encryption. 188 A program interpreting IMAP URLs MAY cache open connections to an 189 IMAP server for later re-use. If a URL contains a user name, only 190 connections authenticated as that user may be re-used. If a URL 191 does not contain a user name or authentication mechanism, then only 192 an anonymous connection may be re-used. If a URL contains an 193 authentication mechanism without a user name, then any non-anony- 194 mous connection may be re-used. 196 Note that if unsafe or reserved characters such as " " or ";" are 197 present in the user name or authentication mechanism, they MUST be 198 encoded as described in [URI-GEN]. 200 3.3. Limitations of enc-user 202 As per sections 3.1 and 3.2 the IMAP URI enc-user has two purposes: 203 1) It provides context for user-specific mailbox paths such 204 as "INBOX" (section 3.1). 205 2) It specifies that resolution of the URL requires logging in as 206 that user and limits use of that URL to only that user (section 207 3.2). 208 An obvious limitation of using the same field for both purposes is 209 that the URL can only be resolved by the mailbox owner. 211 URLAUTH overrides the second purpose of the enc-user in the IMAP 212 URI and by default permits the URI to be resolved by any user per- 213 mitted by the access identifier. URLAUTH is described in section 214 7.1. 216 4. IMAP server 218 An IMAP URL referring to an IMAP server has the following form: 220 imap:/// 222 A program interpreting this URL would issue the standard set of 223 commands it uses to present a view of the contents of an IMAP 224 server. This is likely to be semanticly equivalent to one of the 225 following URLs: 227 imap:///;TYPE=LIST 228 imap:///;TYPE=LSUB 230 See section 5 for details on how such URLs should be processed. 232 The program interpreting this URL SHOULD use the LSUB form if it 233 supports mailbox subscriptions. 235 5. Lists of mailboxes 237 An IMAP URL referring to a list of mailboxes has the following 238 form: 240 imap:///;TYPE= 242 The may be either "LIST" or "LSUB", and is case insen- 243 sitive. The field ";TYPE=" MUST be included. 245 The is any argument suitable for the list-mail- 246 box field of the IMAP [IMAP4] LIST or LSUB commands. The field 247 may be omitted, in which case the program inter- 248 preting the IMAP URL may use "*" or "%" as the . 249 The program SHOULD use "%" if it supports a hierarchical view, oth- 250 erwise it SHOULD use "*". 252 Note that if unsafe or reserved characters such as " " or "%" are 253 present in they MUST be encoded as described in 254 [URI-GEN]. If the character "/" is present in enc-list-mailbox, it 255 SHOULD NOT be encoded. 257 If the field is omitted or is defined to be "*" 258 or "%" the following procedure for listing mailboxes is RECOM- 259 MENDED: 261 The program SHOULD first use the NAMESPACE [NAMESPACE] command (if 262 supported by the server) to discover available namespaces, for 263 example: 265 C: A001 NAMESPACE 266 S: * NAMESPACE (("" "/")) NIL (("Public Folders/" "/")) 267 S: A001 OK NAMESPACE command completed 269 After that it should issue a LIST/LSUB command (as described by 270 ) for each namespace, suppressing redundant list com- 271 mands if the server lists mailboxes for multiple namespaces as a 272 result of a single list command. For example (continuing the exam- 273 ple above), the client first issues . If the server 274 returns information for mailboxes under the shared namespace prefix 275 "Public Folders/" the client should omit the subsequent command. 278 If the NAMESPACE command is not supported by the IMAP server, the 279 client SHOULD issue "" >. 281 <> 284 6. Lists of messages 286 An IMAP URL referring to a list of messages has the following form: 288 imap:///[uidvalidity][?] 290 The field is used as the argument to the IMAP4 291 "SELECT" command. Note that if unsafe or reserved characters such 292 as " ", ";", or "?" are present in they MUST be 293 encoded as described in [URI-GEN]. If the character "/" is present 294 in enc-mailbox, it SHOULD NOT be encoded. 296 The [uidvalidity] field is optional. If it is present, it MUST be 297 the argument to the IMAP4 UIDVALIDITY status response at the time 298 the URL was created. This SHOULD be used by the program interpret- 299 ing the IMAP URL to determine if the URL is stale. 301 The [?] field is optional. If it is not present, the 302 contents of the mailbox SHOULD be presented by the program inter- 303 preting the URL. If it is present, it SHOULD be used as the argu- 304 ments following an IMAP4 SEARCH command with unsafe characters such 305 as " " (which are likely to be present in the ) encoded 306 as described in [URI-GEN]. Note that quoted strings and non-syn- 307 chronizing literals [LITERAL+] are allowed in the con- 308 tent, however synchronizing literals are not allowed, as their 309 presence would effectively mean that the agent interpreting IMAP 310 URLs need to parse an content, find all synchrnonizing 311 literals and perform proper command continuation request handling 312 (see sections 4.3 and 7 of [IMAP4]). 314 7. A specific message or message part 316 An IMAP URL referring to a specific message or message part has the 317 following form: 319 imap:///[uidvalidity] 320 [isection][ipartial] 322 The and [uidvalidity] are as defined above. 324 If [uidvalidity] is present in this form, it SHOULD be used by the 325 program interpreting the URL to determine if the URL is stale. 327 The refers to an IMAP4 message UID, and SHOULD be used as 328 the argument to the IMAP4 "UID FETCH" command. 330 The [isection] field is optional. If not present, the URL refers 331 to the entire Internet message as returned by the IMAP command "UID 332 FETCH BODY.PEEK[]". If present, the URL refers to the object 333 returned by a "UID FETCH BODY.PEEK[
]" command. The 334 type of the object may be determined with a "UID FETCH BODYS- 335 TRUCTURE" command and locating the appropriate part in the result- 336 ing BODYSTRUCTURE. Note that unsafe characters in [isection] MUST 337 be encoded as described in [URI-GEN]. 339 The [ipartial] field is optional. If present, it effectively 340 appends "<>" to the end of the UID FETCH 341 BODY.PEEK[
] command constructed as described in the previ- 342 ous paragraph. In other words it allows the client to request a 343 byte range of the message/message part. 345 7.1 URLAUTH authorized URL 347 <> 350 7.1.1. Concepts 352 7.1.1.1. URLAUTH 354 The URLAUTH is a component, appended at the end of a URL, which 355 conveys authorization to access the data addressed by that URL. It 356 contains an authorized access identifier, an authorization mecha- 357 nism name, and an authorization token. The authorization token is 358 generated from the URL, the authorized access identifer, authoriza- 359 tion mechanism name, and a mailbox access key. 361 7.1.1.2. Mailbox Access Key 363 The mailbox access key is a random string with at least 128 bits of 364 entropy. It is generated by software (not by the human user), and 365 MUST be unpredictable. 367 Each user has a table of mailboxes and an associated mailbox access 368 key for each mailbox. Consequently, the mailbox access key is per- 369 user and per-mailbox. In other words, two users sharing the same 370 mailbox each have a different mailbox access key for that mailbox, 371 and each mailbox accessed by a single user also has a different 372 mailbox access key. 374 7.1.1.3. Authorized Access Identifier 376 The authorized access identifier restricts use of the URLAUTH 377 authorized URL to certain users authorized on the server, as 378 described in section 7.1.2. 380 7.1.1.4. Authorization Mechanism 382 The authorization mechanism is the algorithm by which the URLAUTH 383 is generated and subsequently verified, using the mailbox access 384 key. 386 7.1.1.5. Authorization Token 388 The authorization token is a deterministic string of at least 128 389 bits which an entity with knowledge of the secret mailbox access 390 key and URL authorization mechanism can use to verify the URL. 392 7.1.2. URLAUTH extensions to IMAP URL 394 A specific message or message part IMAP URL can optionally contain 395 ";EXPIRE=" and ";URLAUTH=::". 397 The URLAUTH is comprised of ";URLAUTH=::", and 398 MUST be at the end of the URL. 400 When ";EXPIRE=" is used, this indicates the latest date 401 and time that the URL is valid. After that date and time, the URL 402 has expired and server implementations MUST reject the URL. If 403 ";EXPIRE=" is not used, the URL has no expiration, <>. 406 The URLAUTH takes the form ";URLAUTH=::". It 407 is composed of three parts. The portion provides the 408 authorized access identifiers which may constrain the operations 409 and users that are permitted to use this URL. The portion 410 provides the authorization mechanism used by the IMAP server to 411 generate the authorization token that follows. The portion 412 provides authorization token. <> 414 The "submit+" access identifier prefix, followed by a userid, indi- 415 cates that only a userid authorized as a message submission entity 416 on behalf of the specified userid is permitted to use this URL. 417 The IMAP server does not validate the specified userid but does 418 validate that the IMAP session has an authorization identity that 419 is authorized as a message submission entity. The authorized mes- 420 sage submission entity MUST validate the userid prior to contacting 421 the IMAP server. 423 The "user+" access identifier prefix, followed by a userid, indi- 424 cates that use of this URL is limited to IMAP sessions which are 425 logged in as the specified userid (that is, have authorization 426 identity as that userid). 428 Note: if a SASL mechanism which provides both authorization and 429 authentication identifiers is used to authenticate to the IMAP 430 server, the "user+" access identifier MUST match the authoriza- 431 tion identifier. If the SASL mechanism can't transport the 432 authorization identifier, the "user+" access identifier MUST 433 match the authorization identifier derived from the authentica- 434 tion identifier (see [SASL]). 436 The "authuser" access identifier indicates that use of this URL is 437 limited to IMAP sessions which are logged in as an authorized user 438 (that is, have authorization identity as an authorized user) of 439 that IMAP server. Use of this URL is prohibited to anonymous IMAP 440 sessions. 442 The "anonymous" access identifier indicates that use of this URL is 443 not restricted by session authorization identity; that is, any IMAP 444 session in authenticated or selected state (as defined in [IMAP4]), 445 including anonymous sessions, may issue a URLFETCH [URLAUTH] using 446 this URL. 448 The authorization token is represented as an ASCII-encoded hexadec- 449 imal string, which is used to authorize the URL. The length and 450 the calculation of the authorization token depends upon the mecha- 451 nism used; but, in all cases, the authorization token is at least 452 128 bits (and therefore at least 32 hexadecimal digits). 454 8. Relative IMAP URLs 456 Relative IMAP URLs are permitted and are resolved according to the 457 rules defined in [URI-GEN] with one exception. In IMAP URLs, 458 parameters are treated as part of the normal path with respect to 459 relative URL resolution. This is believed to be the behavior of 460 the installed base and is likely to be documented in a future revi- 461 sion of the relative URL specification. 463 The following observations are also important: 465 The grammar element is considered part of the user name for 466 purposes of resolving relative IMAP URLs. This means that unless a 467 new login/server specification is included in the relative URL, the 468 authentication mechanism is inherited from a base IMAP URL. 470 URLs always use "/" as the hierarchy delimiter for the purpose of 471 resolving paths in relative URLs. IMAP4 permits the use of any 472 hierarchy delimiter in mailbox names. For this reason, relative 473 mailbox paths will only work if the mailbox uses "/" as the hierar- 474 chy delimiter. Relative URLs may be used on mailboxes which use 475 other delimiters, but in that case, the entire mailbox name MUST be 476 specified in the relative URL or inherited as a whole from the base 477 URL. 479 The base URL for a list of mailboxes or messages which was referred 480 to by an IMAP URL is always the referring IMAP URL itself. The 481 base URL for a message or message part which was referred to by an 482 IMAP URL may be more complicated to determine. The program inter- 483 preting the relative URL will have to check the headers of the MIME 484 entity and any enclosing MIME entities in order to locate the "Con- 485 tent-Location" header. This header is used to determine the base 486 URL as defined in section 5 of [MHTML]. For example, if the refer- 487 ring IMAP URL contains a "/;SECTION=1.2" parameter, then the MIME 488 headers for section 1.2, for section 1, and for the enclosing mes- 489 sage itself SHOULD be checked in that order for "Content-Location" 490 headers. 492 9. Multinational Considerations 494 IMAP4 [IMAP4] section 5.1.3 includes a convention for encoding non- 495 US-ASCII characters in IMAP mailbox names. Because this convention 496 is private to IMAP, it is necessary to convert IMAP's encoding to 497 one that can be more easily interpreted by a URL display program. 499 For this reason, IMAP's modified UTF-7 encoding for mailboxes MUST 500 be converted to UTF-8 [UTF-8]. Since 8-bit characters are not per- 501 mitted in URLs, the UTF-8 characters are encoded as required by the 502 URL specification [URI-GEN], section 2.1. Sample code is included 503 in Appendix A to demonstrate this conversion. 505 IMAP usernames are UTF-8 strings and MUST be encoded as required by 506 the URL specification [URI-GEN], section 2.1. 508 Also note that IMAP SEARCH criteria can contain non US-ASCII char- 509 acters. 8-bit octets in those strings MUST be encoded as required 510 by the URL specification [URI-GEN], section 2.1. 512 10. Examples 514 The following examples demonstrate how an IMAP4 client program 515 might translate various IMAP4 URLs into a series of IMAP4 commands. 516 Commands sent from the client to the server are prefixed with "C:", 517 and responses sent from the server to the client are prefixed with 518 "S:". 520 The URL: 522 525 Results in the following client commands: 527 528 C: A001 LOGIN ANONYMOUS sheridan@babylon5.example.org 529 C: A002 SELECT gray-council 530 531 C: A003 UID FETCH 20 BODY.PEEK[]<0.1024> 533 The URL: 535 537 Results in the following client commands: 539 540 542 C: A001 LOGIN MICHAEL zipper 543 C: A002 LIST "" users.* 545 The URL: 547 550 Results in the following client commands: 552 553 C: A001 LOGIN ANONYMOUS bester@psycop.psicorp.example.org 554 C: A002 SELECT ~peter/&ZeVnLIqe-/&U,BTFw- 555 557 The URL: 559 562 Results in the following client commands: 564 565 C: A001 AUTHENTICATE GSSAPI 566 567 C: A002 SELECT gray-council 568 C: A003 UID FETCH 20 BODY.PEEK[1.2] 570 If the following relative URL is located in that body part: 572 <;section=1.4> 574 This could result in the following client commands: 576 C: A004 UID FETCH 20 (BODY.PEEK[1.2.MIME] 577 BODY.PEEK[1.MIME] 578 BODY.PEEK[HEADER.FIELDS (Content-Base Content-Location)]) 579 581 C: A005 UID FETCH 20 BODY.PEEK[1.4] 583 The URL: 585 588 Could result in the following: 590 591 C: A001 CAPABILITY 592 S: * CAPABILITY IMAP4rev1 AUTH=DIGEST-MD5 593 S: A001 OK 594 C: A002 AUTHENTICATE DIGEST-MD5 595 596 S: A002 OK user lennier authenticated 597 C: A003 SELECT "gray council" 598 ... 599 C: A004 SEARCH SUBJECT shadows 600 S: * SEARCH 8 10 13 14 15 16 601 S: A004 OK SEARCH completed 602 C: A005 FETCH 8,10,13:16 ALL 603 ... 604 NOTE: In this final example, the client has implementation depen- 605 dent choices. The authentication mechanism could be anything, 606 including PREAUTH. And the final FETCH command could fetch more or 607 less information about the messages, depending on what it wishes to 608 display to the user. 610 The URL: 612 616 shows that 8-bit data can be sent using non-synchronizing literals 617 [LITERAL+]. This could result in the following: 619 620 C: A001 CAPABILITY 621 S: * CAPABILITY IMAP4rev1 LITERAL+ AUTH=DIGEST-MD5 622 S: A001 OK 623 C: A002 AUTHENTICATE DIGEST-MD5 624 625 S: A002 OK user john authenticated 626 C: A003 SELECT babylon5/personel 627 ... 628 C: A004 SEARCH CHARSET UTF-8 SUBJECT {14+} 629 C: XXXXXXXXXXXXXX 630 S: * SEARCH 7 10 12 631 S: A004 OK SEARCH completed 632 C: A005 FETCH 7,10,12 ALL 633 ... 635 Where XXXXXXXXXXXXXX is 14 bytes of UTF-8 encoded data as specified 636 in the URL above. 638 11. Security Considerations 640 Security considerations discussed in the IMAP specification [IMAP4] 641 and the URI specification [URI-GEN] are relevant. Security consid- 642 erations related to authenticated URLs are discussed in section 3 643 of this document. 645 Many email clients store the plain text password for later use 646 after logging into an IMAP server. Such clients MUST NOT use a 647 stored password in response to an IMAP URL without explicit permis- 648 sion from the user to supply that password to the specified host 649 name. 651 12. ABNF for IMAP URL scheme 653 Formal syntax is defined using ABNF [ABNF], extending the ABNF 654 rules in section 9 of [IMAP4]. Elements not defined here can be 655 found in the [ABNF], [IMAP4], [IMAPABNF] or [URI-GEN]. Strings are 656 not case sensitive and free insertion of linear-white-space is not 657 permitted. 659 sub-delims-sh = "!" / "$" / "'" / "(" / ")" / 660 "*" / "+" / "," 661 ;; <> 670 bchar = achar / ":" / "@" / "/" 672 enc-auth-type = 1*achar 673 ; encoded version of [IMAP4] "auth-type" 675 enc-list-mailbox = 1*bchar 676 ; encoded version of [IMAP4] "list-mailbox" 678 enc-mailbox = 1*bchar 679 ; encoded version of [IMAP4] "mailbox" 681 enc-search = 1*bchar 682 ; encoded version of [IMAPABNF] 683 ; "search-program". Note that IMAP4 684 ; literals may not be used in 685 ; a "search-program", i.e. only 686 ; quoted or non-synchronizing 687 ; literals (if the server supports 688 ; LITERAL+ [LITERAL+]) are allowed. 690 enc-section = 1*bchar 691 ; encoded version of [IMAP4] "section-spec" 693 enc-user = 1*achar 694 ; encoded version of [IMAP4] authorization identity 695 ; or "userid". 697 imapurl = "imap://" iserver "/" [ icommand ] 699 <> 702 authimapurl = "imap://" iserver "/" imessagepart 703 ; <<"imapurl" with "[icommand] == imessagepart">> 705 authimapurlfull = authimapurl iurlauth 706 ; <<"imapurl" with "[icommand] == 707 ; imessagepart iurlauth">> 709 authimapurlrump = authimapurl iurlauth-rump 711 <> 715 enc-urlauth = 32*HEXDIG 716 iurlauth = iurlauth-rump iua-verifier 718 iua-verifier = ":" uauth-mechanism ":" enc-urlauth 720 iurlauth-rump = [expire] ";URLAUTH=" access 722 access = ("submit+" enc-user) / ("user+" enc-user) / 723 "authuser" / "anonymous" 725 expire = ";EXPIRE=" date-time 726 ; date-time defined in [DATETIME] 728 uauth-mechanism = "INTERNAL" / 1*(alpha / digit / "-" / ".") 729 ; case-insensitive 730 ; new mechanisms MUST be registered with IANA 732 <> 734 <> 736 iauth = ";AUTH=" ( "*" / enc-auth-type ) 738 icommand = imailboxlist / 739 imessagelist / 740 imessagepart [iurlauth] 742 imailboxlist = [enc-list-mailbox] ";TYPE=" list-type 744 imailbox-ref = enc-mailbox [uidvalidity] 745 ; <> 747 imessagelist = imailbox-ref [ "?" enc-search ] 748 ; "enc-search" is [URI-GEN] "query". 750 imessagepart = imailbox-ref iuid [isection] [ipartial] 752 ipartial = "/;PARTIAL=" partial-range 754 isection = "/;SECTION=" enc-section 756 iserver = [iuserinfo "@"] host [ ":" port ] 757 ; This is the same as "authority" defined 758 ; in [URI-GEN]. See [URI-GEN] for "host" 759 ; and "port" definitions. 761 iuid = "/;UID=" nz-number 762 ; See [IMAP4] for "nz-number" definition 764 iuserinfo = enc-user [iauth] / [enc-user] iauth 765 ; conforms to the generic syntax of 766 ; "userinfo" as defined in [URI-GEN]. 768 list-type = "LIST" / "LSUB" 770 partial-range = number ["." nz-number] 771 ; partial fetch 773 uidvalidity = ";UIDVALIDITY=" nz-number 774 ; See [IMAP4] for "nz-number" definition 776 13. IANA Considerations 778 IANA is requested to update "imap" definition in the "Uniform 779 Resource Identifier scheme registry" to point to this document. 781 The registration template (as per <>) is specified in section 13.1 of this docu- 783 ment. 785 13.1. IANA Registration of imap: URI Scheme 787 This section provides the information required to register the 788 imap: URI scheme. 790 URI scheme name: imap 792 Status: permanent 794 URI scheme syntax: 795 See section 12 of this RFC. 797 URI scheme semantics: 799 The imap: URI scheme is used to designate IMAP servers, mail- 800 boxes, messages, MIME bodies [MIME], and search programs on Inter- 801 net hosts accessible using the IMAP protocol. <> 804 There is no MIME type associated with this URI. 806 Encoding considerations: 808 See Section 9 of <<[this RFC]>>. 810 Applications/protocols that use this URI scheme name: 812 The imap: URI is intended to be used by applications that might 813 need access to IMAP mailstore. Such applications may include (but 814 not limited to) IMAP-capable web browsers; IMAP clients that wish 815 to access a mailbox, message, or edit a message on the server using 816 [CATENATE]; [SUBMIT] clients and servers that are requested to 817 assemble a complete message on submission using [BURL]. 819 Interoperability considerations: 821 A widely deployed IMAP client Mozilla/Thubderbird use a differ- 822 ent imap: scheme internally. <> 824 Security considerations: 826 See Security Considerations (Section 11) of <<[this RFC]>>. 828 Contact: 830 Alexey Melnikov 832 Author/Change controller: 834 IESG 836 References: 838 [This RFC] and [IMAP4]. 840 14. References 842 14.1. Normative References 844 [KEYWORDS] Bradner, "Key words for use in RFCs to Indicate Require- 845 ment Levels", RFC 2119, Harvard University, March 1997. 847 [IMAP4] Crispin, M., "Internet Message Access Protocol - Version 848 4rev1", RFC 3501, University of Washington, March 2003. 850 [IMAPABNF] Melnikov, A., and C. Daboo, "Collected extensions to 851 IMAP4 ABNF", work in progress, draft-melnikov-imap-ext-abnf-XX.txt. 853 [MHTML] Palme, J., Hopmann, A. and N. Shelness, "MIME Encapsulation 854 of Aggregate Documents, such as HTML (MHTML)", RFC 2557, March 855 1999. 857 [ABNF] Crocker, Overell, "Augmented BNF for Syntax Specifications: 858 ABNF", RFC 4234, October 2005. 860 [MIME] Freed, N., Borenstein, N., "Multipurpose Internet Mail 861 Extensions", RFC 2045, Innosoft, First Virtual, November 1996. 863 [URI-GEN] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform 864 Resource Identifier (URI): Generic Syntax", RFC 3986, January 2005. 866 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO 867 10646", STD 63, RFC 3629, November 2003. 869 [NAMESPACE] Gahrns, M. and C. Newman, "IMAP4 Namespace", RFC 2342, 870 May 1998. 872 [LITERAL+] Myers, J., "IMAP4 non-synchronizing literals", RFC 2088, 873 January 1997. 875 [ANONYMOUS] K. Zeilenga (Ed.), "The Anonymous SASL Mechanism", work 876 in progress, draft-ietf-sasl-anon-XX.txt (Obsoletes RFC 2245). 878 [DATETIME] Klyne, G., and Newman, C., "Date and Time on the Inter- 879 net: Timestamps", RFC 3339, July 2002. 881 14.2. Informative References 883 [SUBMIT] Gellens, R. and Klensin, J., "Message Submission for 884 Mail", draft-gellens-submit-bis-02.txt. 886 [BURL] Newman, C. "Message Composition", work in progress, draft- 887 ietf-lemonade-burl-XX.txt. 889 [CATENATE] Resnick, P. "Internet Message Access Protocol (IMAP) 890 CATENATE Extension", work in progress, draft-ietf-lemonade-cate- 891 nate-XX.txt. 893 [SASL] <>. 896 15. Author's Address 898 Chris Newman 899 Sun Microsystems 900 3401 Centrelake Dr., Suite 410 901 Ontario, CA 91761 902 EMail: chris.newman@sun.com 904 Alexey Melnikov (Editor) 905 Isode Limited 906 5 Castle Business Village 907 36 Station Road 908 Hampton, Middlesex 909 TW12 2BX, UK 910 Email: Alexey.Melnikov@isode.com 911 URI: http://www.melnikov.ca/ 913 Stephane H. Maes (Editor) 914 Oracle Corporation 915 500 Oracle Parkway 916 M/S 4op634 917 Redwood Shores, CA 94065 918 USA 919 Phone: +1-650-607-6296 920 Email: stephane.maes@oracle.com 922 Appendix A. Sample code 924 Here is sample C source code to convert between URL paths and IMAP mail- 925 box names, taking into account mapping between IMAP's modified UTF-7 926 [IMAP4] and hex-encoded UTF-8 which is more appropriate for URLs. This 927 code has not been rigorously tested nor does it necessarily behave rea- 928 sonably with invalid input, but it should serve as a useful example. 929 This code just converts the mailbox portion of the URL and does not deal 930 with parameters, query or server components of the URL. 932 <> 934 #include 935 #include 937 /* hexadecimal lookup table */ 938 static char hex[] = "0123456789ABCDEF"; 940 /* URL unsafe printable characters */ 941 static char urlunsafe[] = " \"#%&+:;<=>?@[\\]^`{|}"; 943 /* UTF7 modified base64 alphabet */ 944 static char base64chars[] = 945 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; 946 #define UNDEFINED 64 948 /* UTF16 definitions */ 949 #define UTF16MASK 0x03FFUL 950 #define UTF16SHIFT 10 951 #define UTF16BASE 0x10000UL 952 #define UTF16HIGHSTART 0xD800UL 953 #define UTF16HIGHEND 0xDBFFUL 954 #define UTF16LOSTART 0xDC00UL 955 #define UTF16LOEND 0xDFFFUL 957 /* Convert an IMAP mailbox to a URL path 958 * dst needs to have roughly 4 times the storage space of src 959 * Hex encoding can triple the size of the input 960 * UTF-7 can be slightly denser than UTF-8 961 * (worst case: 8 octets UTF-7 becomes 9 octets UTF-8) 962 */ 963 void MailboxToURL(char *dst, char *src) 964 { 965 unsigned char c, i, bitcount; 966 unsigned long ucs4, utf16, bitbuf; 967 unsigned char base64[256], utf8[6]; 969 /* initialize modified base64 decoding table */ 970 memset(base64, UNDEFINED, sizeof (base64)); 971 for (i = 0; i < sizeof (base64chars); ++i) { 972 base64[base64chars[i]] = i; 973 } 975 /* loop until end of string */ 976 while (*src != '\0') { 977 c = *src++; 978 /* deal with literal characters and &- */ 979 if (c != '&' || *src == '-') { 980 if (c < ' ' || c > '~' || strchr(urlunsafe, c) != NULL) { 981 /* hex encode if necessary */ 982 dst[0] = '%'; 983 dst[1] = hex[c >> 4]; 984 dst[2] = hex[c & 0x0f]; 985 dst += 3; 987 } else { 988 /* encode literally */ 989 *dst++ = c; 990 } 991 /* skip over the '-' if this is an &- sequence */ 992 if (c == '&') ++src; 993 } else { 994 /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ 995 bitbuf = 0; 996 bitcount = 0; 997 ucs4 = 0; 998 while ((c = base64[(unsigned char) *src]) != UNDEFINED) { 999 ++src; 1000 bitbuf = (bitbuf << 6) | c; 1001 bitcount += 6; 1002 /* enough bits for a UTF-16 character? */ 1003 if (bitcount >= 16) { 1004 bitcount -= 16; 1005 utf16 = (bitcount ? bitbuf >> bitcount 1006 : bitbuf) & 0xffff; 1007 /* convert UTF16 to UCS4 */ 1008 if 1009 (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { 1010 ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; 1011 continue; 1012 } else if 1013 (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { 1014 ucs4 += utf16 - UTF16LOSTART + UTF16BASE; 1015 } else { 1016 ucs4 = utf16; 1017 } 1018 /* convert UTF-16 range of UCS4 to UTF-8 */ 1019 if (ucs4 <= 0x7fUL) { 1020 utf8[0] = ucs4; 1021 i = 1; 1022 } else if (ucs4 <= 0x7ffUL) { 1023 utf8[0] = 0xc0 | (ucs4 >> 6); 1024 utf8[1] = 0x80 | (ucs4 & 0x3f); 1025 i = 2; 1026 } else if (ucs4 <= 0xffffUL) { 1027 utf8[0] = 0xe0 | (ucs4 >> 12); 1028 utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); 1029 utf8[2] = 0x80 | (ucs4 & 0x3f); 1030 i = 3; 1031 } else { 1032 utf8[0] = 0xf0 | (ucs4 >> 18); 1033 utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); 1034 utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); 1035 utf8[3] = 0x80 | (ucs4 & 0x3f); 1036 i = 4; 1037 } 1038 /* convert utf8 to hex */ 1039 for (c = 0; c < i; ++c) { 1040 dst[0] = '%'; 1041 dst[1] = hex[utf8[c] >> 4]; 1042 dst[2] = hex[utf8[c] & 0x0f]; 1043 dst += 3; 1044 } 1045 } 1046 } 1047 /* skip over trailing '-' in modified UTF-7 encoding */ 1048 if (*src == '-') ++src; 1049 } 1050 } 1051 /* terminate destination string */ 1052 *dst = '\0'; 1053 } 1055 /* Convert hex coded UTF-8 URL path to modified UTF-7 IMAP mailbox 1056 * dst should be about twice the length of src to deal with non-hex 1057 * coded URLs 1058 */ 1059 void URLtoMailbox(char *dst, char *src) 1060 { 1061 unsigned int utf8pos, utf8total, i, c, utf7mode, bitstogo, utf16flag; 1062 unsigned long ucs4, bitbuf; 1063 unsigned char hextab[256]; 1065 /* initialize hex lookup table */ 1066 memset(hextab, 0, sizeof (hextab)); 1067 for (i = 0; i < sizeof (hex); ++i) { 1068 hextab[hex[i]] = i; 1069 if (isupper(hex[i])) hextab[tolower(hex[i])] = i; 1070 } 1072 utf7mode = 0; 1073 utf8total = 0; 1074 bitstogo = 0; 1075 while ((c = *src) != '\0') { 1076 ++src; 1077 /* undo hex-encoding */ 1078 if (c == '%' && src[0] != '\0' && src[1] != '\0') { 1079 c = (hextab[src[0]] << 4) | hextab[src[1]]; 1080 src += 2; 1081 } 1082 /* normal character? */ 1083 if (c >= ' ' && c <= '~') { 1084 /* switch out of UTF-7 mode */ 1085 if (utf7mode) { 1086 if (bitstogo) { 1087 *dst++ = base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; 1088 } 1089 *dst++ = '-'; 1090 utf7mode = 0; 1091 } 1092 *dst++ = c; 1093 /* encode '&' as '&-' */ 1094 if (c == '&') { 1095 *dst++ = '-'; 1096 } 1097 continue; 1098 } 1099 /* switch to UTF-7 mode */ 1100 if (!utf7mode) { 1101 *dst++ = '&'; 1102 utf7mode = 1; 1103 } 1104 /* Encode US-ASCII characters as themselves */ 1105 if (c < 0x80) { 1106 ucs4 = c; 1107 utf8total = 1; 1108 } else if (utf8total) { 1109 /* save UTF8 bits into UCS4 */ 1110 ucs4 = (ucs4 << 6) | (c & 0x3FUL); 1111 if (++utf8pos < utf8total) { 1112 continue; 1113 } 1114 } else { 1115 utf8pos = 1; 1116 if (c < 0xE0) { 1117 utf8total = 2; 1118 ucs4 = c & 0x1F; 1119 } else if (c < 0xF0) { 1120 utf8total = 3; 1121 ucs4 = c & 0x0F; 1122 } else { 1123 /* NOTE: can't convert UTF8 sequences longer than 4 */ 1124 utf8total = 4; 1125 ucs4 = c & 0x03; 1126 } 1127 continue; 1128 } 1129 /* loop to split ucs4 into two utf16 chars if necessary */ 1130 utf8total = 0; 1131 do { 1132 if (ucs4 >= UTF16BASE) { 1133 ucs4 -= UTF16BASE; 1134 bitbuf = (bitbuf << 16) | ((ucs4 >> UTF16SHIFT) 1135 + UTF16HIGHSTART); 1136 ucs4 = (ucs4 & UTF16MASK) + UTF16LOSTART; 1137 utf16flag = 1; 1138 } else { 1139 bitbuf = (bitbuf << 16) | ucs4; 1140 utf16flag = 0; 1141 } 1142 bitstogo += 16; 1143 /* spew out base64 */ 1144 while (bitstogo >= 6) { 1145 bitstogo -= 6; 1146 *dst++ = base64chars[(bitstogo ? (bitbuf >> bitstogo) 1147 : bitbuf) 1148 & 0x3F]; 1149 } 1150 } while (utf16flag); 1151 } 1152 /* if in UTF-7 mode, finish in ASCII */ 1153 if (utf7mode) { 1154 if (bitstogo) { 1155 *dst++ = base64chars[(bitbuf << (6 - bitstogo)) & 0x3F]; 1156 } 1157 *dst++ = '-'; 1158 } 1159 /* tie off string */ 1160 *dst = '\0'; 1161 } 1163 Appendix B. List of changes since RFC 2192 1165 <> 1166 Updated boilerplate, list of editor's, etc. 1167 Updated references. 1168 Updated ABNF not to use _, to use SP instead of SPACE. 1169 Updated example domains to use example.org. 1170 Fixed ABNF error in "imessagelist" non-terminal. 1171 Updated ABNF, due to changes in RFC 3501, IMAPABNF and RFC 3986. 1172 Renamed "iuserauth" non-terminal to "iuserinfo". 1173 Clarified that the userinfo component describes both authorization 1174 identity and mailbox naming scope. 1175 Allow for non-synchronizing literals in "enc-search". 1176 Added "ipartial" specifier that denotes a partial fetch. 1177 Moved URLAUTH text from RFC <> to this document. 1179 Intellectual Property 1181 The IETF takes no position regarding the validity or scope of any 1182 Intellectual Property Rights or other rights that might be claimed 1183 to pertain to the implementation or use of the technology 1184 described in this document or the extent to which any license 1185 under such rights might or might not be available; nor does it 1186 represent that it has made any independent effort to identify any 1187 such rights. Information on the procedures with respect to rights 1188 in RFC documents can be found in BCP 78 and BCP 79. 1190 Copies of IPR disclosures made to the IETF Secretariat and any 1191 assurances of licenses to be made available, or the result of an 1192 attempt made to obtain a general license or permission for the use 1193 of such proprietary rights by implementers or users of this 1194 specification can be obtained from the IETF on-line IPR repository 1195 at http://www.ietf.org/ipr. 1197 The IETF invites any interested party to bring to its attention 1198 any copyrights, patents or patent applications, or other 1199 proprietary rights that may cover technology that may be required 1200 to implement this standard. Please address the information to the 1201 IETF at ietf-ipr@ietf.org. 1203 Full Copyright Statement 1205 Copyright (C) The Internet Society (2006). 1207 This document is subject to the rights, licenses and restrictions 1208 contained in BCP 78, and except as set forth therein, the authors 1209 retain all their rights. 1211 This document and the information contained herein are provided on an 1212 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 1213 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 1214 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 1215 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 1216 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 1217 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 1219 Acknowledgement 1221 Funding for the RFC Editor function is currently provided by the 1222 Internet Society.