GSS_S_PROMPTING_NEEDED is a bit
[cyrus-sasl.git] / doc / rfc1939.txt
1
2
3
4
5
6
7 Network Working Group                                           J. Myers
8 Request for Comments: 1939                               Carnegie Mellon
9 STD: 53                                                          M. Rose
10 Obsoletes: 1725                             Dover Beach Consulting, Inc.
11 Category: Standards Track                                       May 1996
12
13
14                     Post Office Protocol - Version 3
15
16 Status of this Memo
17
18    This document specifies an Internet standards track protocol for the
19    Internet community, and requests discussion and suggestions for
20    improvements.  Please refer to the current edition of the "Internet
21    Official Protocol Standards" (STD 1) for the standardization state
22    and status of this protocol.  Distribution of this memo is unlimited.
23
24 Table of Contents
25
26    1. Introduction ................................................    2
27    2. A Short Digression ..........................................    2
28    3. Basic Operation .............................................    3
29    4. The AUTHORIZATION State .....................................    4
30       QUIT Command ................................................    5
31    5. The TRANSACTION State .......................................    5
32       STAT Command ................................................    6
33       LIST Command ................................................    6
34       RETR Command ................................................    8
35       DELE Command ................................................    8
36       NOOP Command ................................................    9
37       RSET Command ................................................    9
38    6. The UPDATE State ............................................   10
39       QUIT Command ................................................   10
40    7. Optional POP3 Commands ......................................   11
41       TOP Command .................................................   11
42       UIDL Command ................................................   12
43       USER Command ................................................   13
44       PASS Command ................................................   14
45       APOP Command ................................................   15
46    8. Scaling and Operational Considerations ......................   16
47    9. POP3 Command Summary ........................................   18
48    10. Example POP3 Session .......................................   19
49    11. Message Format .............................................   19
50    12. References .................................................   20
51    13. Security Considerations ....................................   20
52    14. Acknowledgements ...........................................   20
53    15. Authors' Addresses .........................................   21
54    Appendix A. Differences from RFC 1725 ..........................   22
55
56
57
58 Myers & Rose                Standards Track                     [Page 1]
59 \f
60 RFC 1939                          POP3                          May 1996
61
62
63    Appendix B. Command Index ......................................   23
64
65 1. Introduction
66
67    On certain types of smaller nodes in the Internet it is often
68    impractical to maintain a message transport system (MTS).  For
69    example, a workstation may not have sufficient resources (cycles,
70    disk space) in order to permit a SMTP server [RFC821] and associated
71    local mail delivery system to be kept resident and continuously
72    running.  Similarly, it may be expensive (or impossible) to keep a
73    personal computer interconnected to an IP-style network for long
74    amounts of time (the node is lacking the resource known as
75    "connectivity").
76
77    Despite this, it is often very useful to be able to manage mail on
78    these smaller nodes, and they often support a user agent (UA) to aid
79    the tasks of mail handling.  To solve this problem, a node which can
80    support an MTS entity offers a maildrop service to these less endowed
81    nodes.  The Post Office Protocol - Version 3 (POP3) is intended to
82    permit a workstation to dynamically access a maildrop on a server
83    host in a useful fashion.  Usually, this means that the POP3 protocol
84    is used to allow a workstation to retrieve mail that the server is
85    holding for it.
86
87    POP3 is not intended to provide extensive manipulation operations of
88    mail on the server; normally, mail is downloaded and then deleted.  A
89    more advanced (and complex) protocol, IMAP4, is discussed in
90    [RFC1730].
91
92    For the remainder of this memo, the term "client host" refers to a
93    host making use of the POP3 service, while the term "server host"
94    refers to a host which offers the POP3 service.
95
96 2. A Short Digression
97
98    This memo does not specify how a client host enters mail into the
99    transport system, although a method consistent with the philosophy of
100    this memo is presented here:
101
102       When the user agent on a client host wishes to enter a message
103       into the transport system, it establishes an SMTP connection to
104       its relay host and sends all mail to it.  This relay host could
105       be, but need not be, the POP3 server host for the client host.  Of
106       course, the relay host must accept mail for delivery to arbitrary
107       recipient addresses, that functionality is not required of all
108       SMTP servers.
109
110
111
112
113
114 Myers & Rose                Standards Track                     [Page 2]
115 \f
116 RFC 1939                          POP3                          May 1996
117
118
119 3. Basic Operation
120
121    Initially, the server host starts the POP3 service by listening on
122    TCP port 110.  When a client host wishes to make use of the service,
123    it establishes a TCP connection with the server host.  When the
124    connection is established, the POP3 server sends a greeting.  The
125    client and POP3 server then exchange commands and responses
126    (respectively) until the connection is closed or aborted.
127
128    Commands in the POP3 consist of a case-insensitive keyword, possibly
129    followed by one or more arguments.  All commands are terminated by a
130    CRLF pair.  Keywords and arguments consist of printable ASCII
131    characters.  Keywords and arguments are each separated by a single
132    SPACE character.  Keywords are three or four characters long. Each
133    argument may be up to 40 characters long.
134
135    Responses in the POP3 consist of a status indicator and a keyword
136    possibly followed by additional information.  All responses are
137    terminated by a CRLF pair.  Responses may be up to 512 characters
138    long, including the terminating CRLF.  There are currently two status
139    indicators: positive ("+OK") and negative ("-ERR").  Servers MUST
140    send the "+OK" and "-ERR" in upper case.
141
142    Responses to certain commands are multi-line.  In these cases, which
143    are clearly indicated below, after sending the first line of the
144    response and a CRLF, any additional lines are sent, each terminated
145    by a CRLF pair.  When all lines of the response have been sent, a
146    final line is sent, consisting of a termination octet (decimal code
147    046, ".") and a CRLF pair.  If any line of the multi-line response
148    begins with the termination octet, the line is "byte-stuffed" by
149    pre-pending the termination octet to that line of the response.
150    Hence a multi-line response is terminated with the five octets
151    "CRLF.CRLF".  When examining a multi-line response, the client checks
152    to see if the line begins with the termination octet.  If so and if
153    octets other than CRLF follow, the first octet of the line (the
154    termination octet) is stripped away.  If so and if CRLF immediately
155    follows the termination character, then the response from the POP
156    server is ended and the line containing ".CRLF" is not considered
157    part of the multi-line response.
158
159    A POP3 session progresses through a number of states during its
160    lifetime.  Once the TCP connection has been opened and the POP3
161    server has sent the greeting, the session enters the AUTHORIZATION
162    state.  In this state, the client must identify itself to the POP3
163    server.  Once the client has successfully done this, the server
164    acquires resources associated with the client's maildrop, and the
165    session enters the TRANSACTION state.  In this state, the client
166    requests actions on the part of the POP3 server.  When the client has
167
168
169
170 Myers & Rose                Standards Track                     [Page 3]
171 \f
172 RFC 1939                          POP3                          May 1996
173
174
175    issued the QUIT command, the session enters the UPDATE state.  In
176    this state, the POP3 server releases any resources acquired during
177    the TRANSACTION state and says goodbye.  The TCP connection is then
178    closed.
179
180    A server MUST respond to an unrecognized, unimplemented, or
181    syntactically invalid command by responding with a negative status
182    indicator.  A server MUST respond to a command issued when the
183    session is in an incorrect state by responding with a negative status
184    indicator.  There is no general method for a client to distinguish
185    between a server which does not implement an optional command and a
186    server which is unwilling or unable to process the command.
187
188    A POP3 server MAY have an inactivity autologout timer.  Such a timer
189    MUST be of at least 10 minutes' duration.  The receipt of any command
190    from the client during that interval should suffice to reset the
191    autologout timer.  When the timer expires, the session does NOT enter
192    the UPDATE state--the server should close the TCP connection without
193    removing any messages or sending any response to the client.
194
195 4. The AUTHORIZATION State
196
197    Once the TCP connection has been opened by a POP3 client, the POP3
198    server issues a one line greeting.  This can be any positive
199    response.  An example might be:
200
201       S:  +OK POP3 server ready
202
203    The POP3 session is now in the AUTHORIZATION state.  The client must
204    now identify and authenticate itself to the POP3 server.  Two
205    possible mechanisms for doing this are described in this document,
206    the USER and PASS command combination and the APOP command.  Both
207    mechanisms are described later in this document.  Additional
208    authentication mechanisms are described in [RFC1734].  While there is
209    no single authentication mechanism that is required of all POP3
210    servers, a POP3 server must of course support at least one
211    authentication mechanism.
212
213    Once the POP3 server has determined through the use of any
214    authentication command that the client should be given access to the
215    appropriate maildrop, the POP3 server then acquires an exclusive-
216    access lock on the maildrop, as necessary to prevent messages from
217    being modified or removed before the session enters the UPDATE state.
218    If the lock is successfully acquired, the POP3 server responds with a
219    positive status indicator.  The POP3 session now enters the
220    TRANSACTION state, with no messages marked as deleted.  If the
221    maildrop cannot be opened for some reason (for example, a lock can
222    not be acquired, the client is denied access to the appropriate
223
224
225
226 Myers & Rose                Standards Track                     [Page 4]
227 \f
228 RFC 1939                          POP3                          May 1996
229
230
231    maildrop, or the maildrop cannot be parsed), the POP3 server responds
232    with a negative status indicator.  (If a lock was acquired but the
233    POP3 server intends to respond with a negative status indicator, the
234    POP3 server must release the lock prior to rejecting the command.)
235    After returning a negative status indicator, the server may close the
236    connection.  If the server does not close the connection, the client
237    may either issue a new authentication command and start again, or the
238    client may issue the QUIT command.
239
240    After the POP3 server has opened the maildrop, it assigns a message-
241    number to each message, and notes the size of each message in octets.
242    The first message in the maildrop is assigned a message-number of
243    "1", the second is assigned "2", and so on, so that the nth message
244    in a maildrop is assigned a message-number of "n".  In POP3 commands
245    and responses, all message-numbers and message sizes are expressed in
246    base-10 (i.e., decimal).
247
248    Here is the summary for the QUIT command when used in the
249    AUTHORIZATION state:
250
251       QUIT
252
253          Arguments: none
254
255          Restrictions: none
256
257          Possible Responses:
258              +OK
259
260          Examples:
261              C: QUIT
262              S: +OK dewey POP3 server signing off
263
264 5. The TRANSACTION State
265
266    Once the client has successfully identified itself to the POP3 server
267    and the POP3 server has locked and opened the appropriate maildrop,
268    the POP3 session is now in the TRANSACTION state.  The client may now
269    issue any of the following POP3 commands repeatedly.  After each
270    command, the POP3 server issues a response.  Eventually, the client
271    issues the QUIT command and the POP3 session enters the UPDATE state.
272
273
274
275
276
277
278
279
280
281
282 Myers & Rose                Standards Track                     [Page 5]
283 \f
284 RFC 1939                          POP3                          May 1996
285
286
287    Here are the POP3 commands valid in the TRANSACTION state:
288
289       STAT
290
291          Arguments: none
292
293          Restrictions:
294              may only be given in the TRANSACTION state
295
296          Discussion:
297              The POP3 server issues a positive response with a line
298              containing information for the maildrop.  This line is
299              called a "drop listing" for that maildrop.
300
301              In order to simplify parsing, all POP3 servers are
302              required to use a certain format for drop listings.  The
303              positive response consists of "+OK" followed by a single
304              space, the number of messages in the maildrop, a single
305              space, and the size of the maildrop in octets.  This memo
306              makes no requirement on what follows the maildrop size.
307              Minimal implementations should just end that line of the
308              response with a CRLF pair.  More advanced implementations
309              may include other information.
310
311                 NOTE: This memo STRONGLY discourages implementations
312                 from supplying additional information in the drop
313                 listing.  Other, optional, facilities are discussed
314                 later on which permit the client to parse the messages
315                 in the maildrop.
316
317              Note that messages marked as deleted are not counted in
318              either total.
319
320          Possible Responses:
321              +OK nn mm
322
323          Examples:
324              C: STAT
325              S: +OK 2 320
326
327
328       LIST [msg]
329
330          Arguments:
331              a message-number (optional), which, if present, may NOT
332              refer to a message marked as deleted
333
334
335
336
337
338 Myers & Rose                Standards Track                     [Page 6]
339 \f
340 RFC 1939                          POP3                          May 1996
341
342
343          Restrictions:
344              may only be given in the TRANSACTION state
345
346          Discussion:
347              If an argument was given and the POP3 server issues a
348              positive response with a line containing information for
349              that message.  This line is called a "scan listing" for
350              that message.
351
352              If no argument was given and the POP3 server issues a
353              positive response, then the response given is multi-line.
354              After the initial +OK, for each message in the maildrop,
355              the POP3 server responds with a line containing
356              information for that message.  This line is also called a
357              "scan listing" for that message.  If there are no
358              messages in the maildrop, then the POP3 server responds
359              with no scan listings--it issues a positive response
360              followed by a line containing a termination octet and a
361              CRLF pair.
362
363              In order to simplify parsing, all POP3 servers are
364              required to use a certain format for scan listings.  A
365              scan listing consists of the message-number of the
366              message, followed by a single space and the exact size of
367              the message in octets.  Methods for calculating the exact
368              size of the message are described in the "Message Format"
369              section below.  This memo makes no requirement on what
370              follows the message size in the scan listing.  Minimal
371              implementations should just end that line of the response
372              with a CRLF pair.  More advanced implementations may
373              include other information, as parsed from the message.
374
375                 NOTE: This memo STRONGLY discourages implementations
376                 from supplying additional information in the scan
377                 listing.  Other, optional, facilities are discussed
378                 later on which permit the client to parse the messages
379                 in the maildrop.
380
381              Note that messages marked as deleted are not listed.
382
383          Possible Responses:
384              +OK scan listing follows
385              -ERR no such message
386
387          Examples:
388              C: LIST
389              S: +OK 2 messages (320 octets)
390              S: 1 120
391
392
393
394 Myers & Rose                Standards Track                     [Page 7]
395 \f
396 RFC 1939                          POP3                          May 1996
397
398
399              S: 2 200
400              S: .
401                ...
402              C: LIST 2
403              S: +OK 2 200
404                ...
405              C: LIST 3
406              S: -ERR no such message, only 2 messages in maildrop
407
408
409       RETR msg
410
411          Arguments:
412              a message-number (required) which may NOT refer to a
413              message marked as deleted
414
415          Restrictions:
416              may only be given in the TRANSACTION state
417
418          Discussion:
419              If the POP3 server issues a positive response, then the
420              response given is multi-line.  After the initial +OK, the
421              POP3 server sends the message corresponding to the given
422              message-number, being careful to byte-stuff the termination
423              character (as with all multi-line responses).
424
425          Possible Responses:
426              +OK message follows
427              -ERR no such message
428
429          Examples:
430              C: RETR 1
431              S: +OK 120 octets
432              S: <the POP3 server sends the entire message here>
433              S: .
434
435
436       DELE msg
437
438          Arguments:
439              a message-number (required) which may NOT refer to a
440              message marked as deleted
441
442          Restrictions:
443              may only be given in the TRANSACTION state
444
445
446
447
448
449
450 Myers & Rose                Standards Track                     [Page 8]
451 \f
452 RFC 1939                          POP3                          May 1996
453
454
455          Discussion:
456              The POP3 server marks the message as deleted.  Any future
457              reference to the message-number associated with the message
458              in a POP3 command generates an error.  The POP3 server does
459              not actually delete the message until the POP3 session
460              enters the UPDATE state.
461
462          Possible Responses:
463              +OK message deleted
464              -ERR no such message
465
466          Examples:
467              C: DELE 1
468              S: +OK message 1 deleted
469                 ...
470              C: DELE 2
471              S: -ERR message 2 already deleted
472
473
474       NOOP
475
476          Arguments: none
477
478          Restrictions:
479              may only be given in the TRANSACTION state
480
481          Discussion:
482              The POP3 server does nothing, it merely replies with a
483              positive response.
484
485          Possible Responses:
486              +OK
487
488          Examples:
489              C: NOOP
490              S: +OK
491
492
493       RSET
494
495          Arguments: none
496
497          Restrictions:
498              may only be given in the TRANSACTION state
499
500          Discussion:
501              If any messages have been marked as deleted by the POP3
502              server, they are unmarked.  The POP3 server then replies
503
504
505
506 Myers & Rose                Standards Track                     [Page 9]
507 \f
508 RFC 1939                          POP3                          May 1996
509
510
511              with a positive response.
512
513          Possible Responses:
514              +OK
515
516          Examples:
517              C: RSET
518              S: +OK maildrop has 2 messages (320 octets)
519
520 6. The UPDATE State
521
522    When the client issues the QUIT command from the TRANSACTION state,
523    the POP3 session enters the UPDATE state.  (Note that if the client
524    issues the QUIT command from the AUTHORIZATION state, the POP3
525    session terminates but does NOT enter the UPDATE state.)
526
527    If a session terminates for some reason other than a client-issued
528    QUIT command, the POP3 session does NOT enter the UPDATE state and
529    MUST not remove any messages from the maildrop.
530
531       QUIT
532
533          Arguments: none
534
535          Restrictions: none
536
537          Discussion:
538              The POP3 server removes all messages marked as deleted
539              from the maildrop and replies as to the status of this
540              operation.  If there is an error, such as a resource
541              shortage, encountered while removing messages, the
542              maildrop may result in having some or none of the messages
543              marked as deleted be removed.  In no case may the server
544              remove any messages not marked as deleted.
545
546              Whether the removal was successful or not, the server
547              then releases any exclusive-access lock on the maildrop
548              and closes the TCP connection.
549
550          Possible Responses:
551              +OK
552              -ERR some deleted messages not removed
553
554          Examples:
555              C: QUIT
556              S: +OK dewey POP3 server signing off (maildrop empty)
557                 ...
558              C: QUIT
559
560
561
562 Myers & Rose                Standards Track                    [Page 10]
563 \f
564 RFC 1939                          POP3                          May 1996
565
566
567              S: +OK dewey POP3 server signing off (2 messages left)
568                 ...
569
570 7. Optional POP3 Commands
571
572    The POP3 commands discussed above must be supported by all minimal
573    implementations of POP3 servers.
574
575    The optional POP3 commands described below permit a POP3 client
576    greater freedom in message handling, while preserving a simple POP3
577    server implementation.
578
579       NOTE: This memo STRONGLY encourages implementations to support
580       these commands in lieu of developing augmented drop and scan
581       listings.  In short, the philosophy of this memo is to put
582       intelligence in the part of the POP3 client and not the POP3
583       server.
584
585       TOP msg n
586
587          Arguments:
588              a message-number (required) which may NOT refer to to a
589              message marked as deleted, and a non-negative number
590              of lines (required)
591
592          Restrictions:
593              may only be given in the TRANSACTION state
594
595          Discussion:
596              If the POP3 server issues a positive response, then the
597              response given is multi-line.  After the initial +OK, the
598              POP3 server sends the headers of the message, the blank
599              line separating the headers from the body, and then the
600              number of lines of the indicated message's body, being
601              careful to byte-stuff the termination character (as with
602              all multi-line responses).
603
604              Note that if the number of lines requested by the POP3
605              client is greater than than the number of lines in the
606              body, then the POP3 server sends the entire message.
607
608          Possible Responses:
609              +OK top of message follows
610              -ERR no such message
611
612          Examples:
613              C: TOP 1 10
614              S: +OK
615
616
617
618 Myers & Rose                Standards Track                    [Page 11]
619 \f
620 RFC 1939                          POP3                          May 1996
621
622
623              S: <the POP3 server sends the headers of the
624                 message, a blank line, and the first 10 lines
625                 of the body of the message>
626              S: .
627                 ...
628              C: TOP 100 3
629              S: -ERR no such message
630
631
632       UIDL [msg]
633
634       Arguments:
635           a message-number (optional), which, if present, may NOT
636           refer to a message marked as deleted
637
638       Restrictions:
639           may only be given in the TRANSACTION state.
640
641       Discussion:
642           If an argument was given and the POP3 server issues a positive
643           response with a line containing information for that message.
644           This line is called a "unique-id listing" for that message.
645
646           If no argument was given and the POP3 server issues a positive
647           response, then the response given is multi-line.  After the
648           initial +OK, for each message in the maildrop, the POP3 server
649           responds with a line containing information for that message.
650           This line is called a "unique-id listing" for that message.
651
652           In order to simplify parsing, all POP3 servers are required to
653           use a certain format for unique-id listings.  A unique-id
654           listing consists of the message-number of the message,
655           followed by a single space and the unique-id of the message.
656           No information follows the unique-id in the unique-id listing.
657
658           The unique-id of a message is an arbitrary server-determined
659           string, consisting of one to 70 characters in the range 0x21
660           to 0x7E, which uniquely identifies a message within a
661           maildrop and which persists across sessions.  This
662           persistence is required even if a session ends without
663           entering the UPDATE state.  The server should never reuse an
664           unique-id in a given maildrop, for as long as the entity
665           using the unique-id exists.
666
667           Note that messages marked as deleted are not listed.
668
669           While it is generally preferable for server implementations
670           to store arbitrarily assigned unique-ids in the maildrop,
671
672
673
674 Myers & Rose                Standards Track                    [Page 12]
675 \f
676 RFC 1939                          POP3                          May 1996
677
678
679           this specification is intended to permit unique-ids to be
680           calculated as a hash of the message.  Clients should be able
681           to handle a situation where two identical copies of a
682           message in a maildrop have the same unique-id.
683
684       Possible Responses:
685           +OK unique-id listing follows
686           -ERR no such message
687
688       Examples:
689           C: UIDL
690           S: +OK
691           S: 1 whqtswO00WBw418f9t5JxYwZ
692           S: 2 QhdPYR:00WBw1Ph7x7
693           S: .
694              ...
695           C: UIDL 2
696           S: +OK 2 QhdPYR:00WBw1Ph7x7
697              ...
698           C: UIDL 3
699           S: -ERR no such message, only 2 messages in maildrop
700
701
702       USER name
703
704          Arguments:
705              a string identifying a mailbox (required), which is of
706              significance ONLY to the server
707
708          Restrictions:
709              may only be given in the AUTHORIZATION state after the POP3
710              greeting or after an unsuccessful USER or PASS command
711
712          Discussion:
713              To authenticate using the USER and PASS command
714              combination, the client must first issue the USER
715              command.  If the POP3 server responds with a positive
716              status indicator ("+OK"), then the client may issue
717              either the PASS command to complete the authentication,
718              or the QUIT command to terminate the POP3 session.  If
719              the POP3 server responds with a negative status indicator
720              ("-ERR") to the USER command, then the client may either
721              issue a new authentication command or may issue the QUIT
722              command.
723
724              The server may return a positive response even though no
725              such mailbox exists.  The server may return a negative
726              response if mailbox exists, but does not permit plaintext
727
728
729
730 Myers & Rose                Standards Track                    [Page 13]
731 \f
732 RFC 1939                          POP3                          May 1996
733
734
735              password authentication.
736
737          Possible Responses:
738              +OK name is a valid mailbox
739              -ERR never heard of mailbox name
740
741          Examples:
742              C: USER frated
743              S: -ERR sorry, no mailbox for frated here
744                 ...
745              C: USER mrose
746              S: +OK mrose is a real hoopy frood
747
748
749       PASS string
750
751          Arguments:
752              a server/mailbox-specific password (required)
753
754          Restrictions:
755              may only be given in the AUTHORIZATION state immediately
756              after a successful USER command
757
758          Discussion:
759              When the client issues the PASS command, the POP3 server
760              uses the argument pair from the USER and PASS commands to
761              determine if the client should be given access to the
762              appropriate maildrop.
763
764              Since the PASS command has exactly one argument, a POP3
765              server may treat spaces in the argument as part of the
766              password, instead of as argument separators.
767
768          Possible Responses:
769              +OK maildrop locked and ready
770              -ERR invalid password
771              -ERR unable to lock maildrop
772
773          Examples:
774              C: USER mrose
775              S: +OK mrose is a real hoopy frood
776              C: PASS secret
777              S: -ERR maildrop already locked
778                ...
779              C: USER mrose
780              S: +OK mrose is a real hoopy frood
781              C: PASS secret
782              S: +OK mrose's maildrop has 2 messages (320 octets)
783
784
785
786 Myers & Rose                Standards Track                    [Page 14]
787 \f
788 RFC 1939                          POP3                          May 1996
789
790
791       APOP name digest
792
793          Arguments:
794              a string identifying a mailbox and a MD5 digest string
795              (both required)
796
797          Restrictions:
798              may only be given in the AUTHORIZATION state after the POP3
799              greeting or after an unsuccessful USER or PASS command
800
801          Discussion:
802              Normally, each POP3 session starts with a USER/PASS
803              exchange.  This results in a server/user-id specific
804              password being sent in the clear on the network.  For
805              intermittent use of POP3, this may not introduce a sizable
806              risk.  However, many POP3 client implementations connect to
807              the POP3 server on a regular basis -- to check for new
808              mail.  Further the interval of session initiation may be on
809              the order of five minutes.  Hence, the risk of password
810              capture is greatly enhanced.
811
812              An alternate method of authentication is required which
813              provides for both origin authentication and replay
814              protection, but which does not involve sending a password
815              in the clear over the network.  The APOP command provides
816              this functionality.
817
818              A POP3 server which implements the APOP command will
819              include a timestamp in its banner greeting.  The syntax of
820              the timestamp corresponds to the `msg-id' in [RFC822], and
821              MUST be different each time the POP3 server issues a banner
822              greeting.  For example, on a UNIX implementation in which a
823              separate UNIX process is used for each instance of a POP3
824              server, the syntax of the timestamp might be:
825
826                 <process-ID.clock@hostname>
827
828              where `process-ID' is the decimal value of the process's
829              PID, clock is the decimal value of the system clock, and
830              hostname is the fully-qualified domain-name corresponding
831              to the host where the POP3 server is running.
832
833              The POP3 client makes note of this timestamp, and then
834              issues the APOP command.  The `name' parameter has
835              identical semantics to the `name' parameter of the USER
836              command. The `digest' parameter is calculated by applying
837              the MD5 algorithm [RFC1321] to a string consisting of the
838              timestamp (including angle-brackets) followed by a shared
839
840
841
842 Myers & Rose                Standards Track                    [Page 15]
843 \f
844 RFC 1939                          POP3                          May 1996
845
846
847              secret.  This shared secret is a string known only to the
848              POP3 client and server.  Great care should be taken to
849              prevent unauthorized disclosure of the secret, as knowledge
850              of the secret will allow any entity to successfully
851              masquerade as the named user.  The `digest' parameter
852              itself is a 16-octet value which is sent in hexadecimal
853              format, using lower-case ASCII characters.
854
855              When the POP3 server receives the APOP command, it verifies
856              the digest provided.  If the digest is correct, the POP3
857              server issues a positive response, and the POP3 session
858              enters the TRANSACTION state.  Otherwise, a negative
859              response is issued and the POP3 session remains in the
860              AUTHORIZATION state.
861
862              Note that as the length of the shared secret increases, so
863              does the difficulty of deriving it.  As such, shared
864              secrets should be long strings (considerably longer than
865              the 8-character example shown below).
866
867          Possible Responses:
868              +OK maildrop locked and ready
869              -ERR permission denied
870
871          Examples:
872              S: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>
873              C: APOP mrose c4c9334bac560ecc979e58001b3e22fb
874              S: +OK maildrop has 1 message (369 octets)
875
876              In this example, the shared  secret  is  the  string  `tan-
877              staaf'.  Hence, the MD5 algorithm is applied to the string
878
879                 <1896.697170952@dbc.mtview.ca.us>tanstaaf
880
881              which produces a digest value of
882
883                 c4c9334bac560ecc979e58001b3e22fb
884
885 8. Scaling and Operational Considerations
886
887    Since some of the optional features described above were added to the
888    POP3 protocol, experience has accumulated in using them in large-
889    scale commercial post office operations where most of the users are
890    unrelated to each other.  In these situations and others, users and
891    vendors of POP3 clients have discovered that the combination of using
892    the UIDL command and not issuing the DELE command can provide a weak
893    version of the "maildrop as semi-permanent repository" functionality
894    normally associated with IMAP.  Of course the other capabilities of
895
896
897
898 Myers & Rose                Standards Track                    [Page 16]
899 \f
900 RFC 1939                          POP3                          May 1996
901
902
903    IMAP, such as polling an existing connection for newly arrived
904    messages and supporting multiple folders on the server, are not
905    present in POP3.
906
907    When these facilities are used in this way by casual users, there has
908    been a tendency for already-read messages to accumulate on the server
909    without bound.  This is clearly an undesirable behavior pattern from
910    the standpoint of the server operator.  This situation is aggravated
911    by the fact that the limited capabilities of the POP3 do not permit
912    efficient handling of maildrops which have hundreds or thousands of
913    messages.
914
915    Consequently, it is recommended that operators of large-scale multi-
916    user servers, especially ones in which the user's only access to the
917    maildrop is via POP3, consider such options as:
918
919    *  Imposing a per-user maildrop storage quota or the like.
920
921       A disadvantage to this option is that accumulation of messages may
922       result in the user's inability to receive new ones into the
923       maildrop.  Sites which choose this option should be sure to inform
924       users of impending or current exhaustion of quota, perhaps by
925       inserting an appropriate message into the user's maildrop.
926
927    *  Enforce a site policy regarding mail retention on the server.
928
929       Sites are free to establish local policy regarding the storage and
930       retention of messages on the server, both read and unread.  For
931       example, a site might delete unread messages from the server after
932       60 days and delete read messages after 7 days.  Such message
933       deletions are outside the scope of the POP3 protocol and are not
934       considered a protocol violation.
935
936       Server operators enforcing message deletion policies should take
937       care to make all users aware of the policies in force.
938
939       Clients must not assume that a site policy will automate message
940       deletions, and should continue to explicitly delete messages using
941       the DELE command when appropriate.
942
943       It should be noted that enforcing site message deletion policies
944       may be confusing to the user community, since their POP3 client
945       may contain configuration options to leave mail on the server
946       which will not in fact be supported by the server.
947
948       One special case of a site policy is that messages may only be
949       downloaded once from the server, and are deleted after this has
950       been accomplished.  This could be implemented in POP3 server
951
952
953
954 Myers & Rose                Standards Track                    [Page 17]
955 \f
956 RFC 1939                          POP3                          May 1996
957
958
959       software by the following mechanism: "following a POP3 login by a
960       client which was ended by a QUIT, delete all messages downloaded
961       during the session with the RETR command".  It is important not to
962       delete messages in the event of abnormal connection termination
963       (ie, if no QUIT was received from the client) because the client
964       may not have successfully received or stored the messages.
965       Servers implementing a download-and-delete policy may also wish to
966       disable or limit the optional TOP command, since it could be used
967       as an alternate mechanism to download entire messages.
968
969 9. POP3 Command Summary
970
971       Minimal POP3 Commands:
972
973          USER name               valid in the AUTHORIZATION state
974          PASS string
975          QUIT
976
977          STAT                    valid in the TRANSACTION state
978          LIST [msg]
979          RETR msg
980          DELE msg
981          NOOP
982          RSET
983          QUIT
984
985       Optional POP3 Commands:
986
987          APOP name digest        valid in the AUTHORIZATION state
988
989          TOP msg n               valid in the TRANSACTION state
990          UIDL [msg]
991
992       POP3 Replies:
993
994          +OK
995          -ERR
996
997       Note that with the exception of the STAT, LIST, and UIDL commands,
998       the reply given by the POP3 server to any command is significant
999       only to "+OK" and "-ERR".  Any text occurring after this reply
1000       may be ignored by the client.
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010 Myers & Rose                Standards Track                    [Page 18]
1011 \f
1012 RFC 1939                          POP3                          May 1996
1013
1014
1015 10. Example POP3 Session
1016
1017       S: <wait for connection on TCP port 110>
1018       C: <open connection>
1019       S:    +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>
1020       C:    APOP mrose c4c9334bac560ecc979e58001b3e22fb
1021       S:    +OK mrose's maildrop has 2 messages (320 octets)
1022       C:    STAT
1023       S:    +OK 2 320
1024       C:    LIST
1025       S:    +OK 2 messages (320 octets)
1026       S:    1 120
1027       S:    2 200
1028       S:    .
1029       C:    RETR 1
1030       S:    +OK 120 octets
1031       S:    <the POP3 server sends message 1>
1032       S:    .
1033       C:    DELE 1
1034       S:    +OK message 1 deleted
1035       C:    RETR 2
1036       S:    +OK 200 octets
1037       S:    <the POP3 server sends message 2>
1038       S:    .
1039       C:    DELE 2
1040       S:    +OK message 2 deleted
1041       C:    QUIT
1042       S:    +OK dewey POP3 server signing off (maildrop empty)
1043       C:  <close connection>
1044       S:  <wait for next connection>
1045
1046 11. Message Format
1047
1048    All messages transmitted during a POP3 session are assumed to conform
1049    to the standard for the format of Internet text messages [RFC822].
1050
1051    It is important to note that the octet count for a message on the
1052    server host may differ from the octet count assigned to that message
1053    due to local conventions for designating end-of-line.  Usually,
1054    during the AUTHORIZATION state of the POP3 session, the POP3 server
1055    can calculate the size of each message in octets when it opens the
1056    maildrop.  For example, if the POP3 server host internally represents
1057    end-of-line as a single character, then the POP3 server simply counts
1058    each occurrence of this character in a message as two octets.  Note
1059    that lines in the message which start with the termination octet need
1060    not (and must not) be counted twice, since the POP3 client will
1061    remove all byte-stuffed termination characters when it receives a
1062    multi-line response.
1063
1064
1065
1066 Myers & Rose                Standards Track                    [Page 19]
1067 \f
1068 RFC 1939                          POP3                          May 1996
1069
1070
1071 12. References
1072
1073    [RFC821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC
1074        821, USC/Information Sciences Institute, August 1982.
1075
1076    [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet Text
1077        Messages", STD 11, RFC 822, University of Delaware, August 1982.
1078
1079    [RFC1321] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
1080        MIT Laboratory for Computer Science, April 1992.
1081
1082    [RFC1730] Crispin, M., "Internet Message Access Protocol - Version
1083        4", RFC 1730, University of Washington, December 1994.
1084
1085    [RFC1734] Myers, J., "POP3 AUTHentication command", RFC 1734,
1086        Carnegie Mellon, December 1994.
1087
1088 13. Security Considerations
1089
1090    It is conjectured that use of the APOP command provides origin
1091    identification and replay protection for a POP3 session.
1092    Accordingly, a POP3 server which implements both the PASS and APOP
1093    commands should not allow both methods of access for a given user;
1094    that is, for a given mailbox name, either the USER/PASS command
1095    sequence or the APOP command is allowed, but not both.
1096
1097    Further, note that as the length of the shared secret increases, so
1098    does the difficulty of deriving it.
1099
1100    Servers that answer -ERR to the USER command are giving potential
1101    attackers clues about which names are valid.
1102
1103    Use of the PASS command sends passwords in the clear over the
1104    network.
1105
1106    Use of the RETR and TOP commands sends mail in the clear over the
1107    network.
1108
1109    Otherwise, security issues are not discussed in this memo.
1110
1111 14. Acknowledgements
1112
1113    The POP family has a long and checkered history.  Although primarily
1114    a minor revision to RFC 1460, POP3 is based on the ideas presented in
1115    RFCs 918, 937, and 1081.
1116
1117    In addition, Alfred Grimstad, Keith McCloghrie, and Neil Ostroff
1118    provided significant comments on the APOP command.
1119
1120
1121
1122 Myers & Rose                Standards Track                    [Page 20]
1123 \f
1124 RFC 1939                          POP3                          May 1996
1125
1126
1127 15. Authors' Addresses
1128
1129    John G. Myers
1130    Carnegie-Mellon University
1131    5000 Forbes Ave
1132    Pittsburgh, PA 15213
1133
1134    EMail: jgm+@cmu.edu
1135
1136
1137    Marshall T. Rose
1138    Dover Beach Consulting, Inc.
1139    420 Whisman Court
1140    Mountain View, CA  94043-2186
1141
1142    EMail: mrose@dbc.mtview.ca.us
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178 Myers & Rose                Standards Track                    [Page 21]
1179 \f
1180 RFC 1939                          POP3                          May 1996
1181
1182
1183 Appendix A. Differences from RFC 1725
1184
1185    This memo is a revision to RFC 1725, a Draft Standard.  It makes the
1186    following changes from that document:
1187
1188       - clarifies that command keywords are case insensitive.
1189
1190       - specifies that servers must send "+OK" and "-ERR" in
1191         upper case.
1192
1193       - specifies that the initial greeting is a positive response,
1194         instead of any string which should be a positive response.
1195
1196       - clarifies behavior for unimplemented commands.
1197
1198       - makes the USER and PASS commands optional.
1199
1200       - clarified the set of possible responses to the USER command.
1201
1202       - reverses the order of the examples in the USER and PASS
1203         commands, to reduce confusion.
1204
1205       - clarifies that the PASS command may only be given immediately
1206         after a successful USER command.
1207
1208       - clarified the persistence requirements of UIDs and added some
1209         implementation notes.
1210
1211       - specifies a UID length limitation of one to 70 octets.
1212
1213       - specifies a status indicator length limitation
1214         of 512 octets, including the CRLF.
1215
1216       - clarifies that LIST with no arguments on an empty mailbox
1217         returns success.
1218
1219       - adds a reference from the LIST command to the Message Format
1220         section
1221
1222       - clarifies the behavior of QUIT upon failure
1223
1224       - clarifies the security section to not imply the use of the
1225         USER command with the APOP command.
1226
1227       - adds references to RFCs 1730 and 1734
1228
1229       - clarifies the method by which a UA may enter mail into the
1230         transport system.
1231
1232
1233
1234 Myers & Rose                Standards Track                    [Page 22]
1235 \f
1236 RFC 1939                          POP3                          May 1996
1237
1238
1239       - clarifies that the second argument to the TOP command is a
1240         number of lines.
1241
1242       - changes the suggestion in the Security Considerations section
1243         for a server to not accept both PASS and APOP for a given user
1244         from a "must" to a "should".
1245
1246       - adds a section on scaling and operational considerations
1247
1248 Appendix B. Command Index
1249
1250        APOP .......................................................   15
1251        DELE .......................................................    8
1252        LIST .......................................................    6
1253        NOOP .......................................................    9
1254        PASS .......................................................   14
1255        QUIT .......................................................    5
1256        QUIT .......................................................   10
1257        RETR .......................................................    8
1258        RSET .......................................................    9
1259        STAT .......................................................    6
1260        TOP ........................................................   11
1261        UIDL .......................................................   12
1262        USER .......................................................   13
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290 Myers & Rose                Standards Track                    [Page 23]
1291 \f