home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / poprfc.zip / rfc1460.txt
Text File  |  1994-09-06  |  39KB  |  955 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                            M. Rose
  8. Request for Comments: 1460                  Dover Beach Consulting, Inc.
  9. Obsoletes: 1225                                                June 1993
  10.  
  11.  
  12.                     Post Office Protocol - Version 3
  13.  
  14.  
  15. Status of this Memo
  16.  
  17.    This RFC specifies an IAB standards track protocol for the Internet
  18.    community, and requests discussion and suggestions for improvements.
  19.    Please refer to the current edition of the "IAB Official Protocol
  20.    Standards" for the standardization state and status of this protocol.
  21.    Distribution of this memo is unlimited.
  22.  
  23. Overview
  24.  
  25.    This memo is a revision to RFC 1225, a Draft Standard.  It makes the
  26.    following changes from that document:
  27.  
  28.         - the RPOP facility is removed;
  29.  
  30.         - the optional APOP facility is added (which is in interoperable,
  31.           operational use in at least three implementations);
  32.  
  33.         - a typo was corrected with respect to the interaction of LAST
  34.           and RSET;
  35.  
  36.         - section numbers were added; and,
  37.  
  38.         - an acknowledgements section was added.
  39.  
  40. 1. Introduction
  41.  
  42.    On certain types of smaller nodes in the Internet it is often
  43.    impractical to maintain a message transport system (MTS).  For
  44.    example, a workstation may not have sufficient resources (cycles,
  45.    disk space) in order to permit a SMTP server [RFC821] and associated
  46.    local mail delivery system to be kept resident and continuously
  47.    running.
  48.  
  49.    Similarly, it may be expensive (or impossible) to keep a personal
  50.    computer interconnected to an IP-style network for long amounts of
  51.    time (the node is lacking the resource known as "connectivity").
  52.  
  53.    Despite this, it is often very useful to be able to manage mail on
  54.    these smaller nodes, and they often support a user agent (UA) to aid
  55.  
  56.  
  57.  
  58. Rose                                                            [Page 1]
  59.  
  60. RFC 1460                          POP3                         June 1993
  61.  
  62.  
  63.    the tasks of mail handling.  To solve this problem, a node which can
  64.    support an MTS entity offers a maildrop service to these less endowed
  65.    nodes.  The Post Office Protocol - Version 3 (POP3) is intended to
  66.    permit a workstation to dynamically access a maildrop on a server
  67.    host in a useful fashion.  Usually, this means that the POP3 is used
  68.    to allow a workstation to retrieve mail that the server is holding
  69.    for it.
  70.  
  71.    For the remainder of this memo, the term "client host" refers to a
  72.    host making use of the POP3 service, while the term "server host"
  73.    refers to a host which offers the POP3 service.
  74.  
  75. 2. A Short Digression
  76.  
  77.    This memo does not specify how a client host enters mail into the
  78.    transport system, although a method consistent with the philosophy of
  79.    this memo is presented here:
  80.  
  81.       When the user agent on a client host wishes to enter a message
  82.       into the transport system, it establishes an SMTP connection to
  83.       its relay host (this relay host could be, but need not be, the
  84.       POP3 server host for the client host).
  85.  
  86.    If this method is followed, then the client host appears to the MTS
  87.    as a user agent, and should NOT be regarded as a "trusted" MTS entity
  88.    in any sense whatsoever.  This concept, along with the role of the
  89.    POP3 as a part of a split-UA model is discussed later in this memo.
  90.  
  91. 3. Basic Operation
  92.  
  93.    Initially, the server host starts the POP3 service by listening on
  94.    TCP port 110.  When a client host wishes to make use of the service,
  95.    it establishes a TCP connection with the server host.  When the
  96.    connection is established, the POP3 server sends a greeting.  The
  97.    client and POP3 server then exchange commands and responses
  98.    (respectively) until the connection is closed or aborted.
  99.  
  100.    Commands in the POP3 consist of a keyword possibly followed by an
  101.    argument.  All commands are terminated by a CRLF pair.
  102.  
  103.    Responses in the POP3 consist of a success indicator and a keyword
  104.    possibly followed by additional information.  All responses are
  105.    terminated by a CRLF pair.  There are currently two success
  106.    indicators: positive ("+OK") and negative ("-ERR").
  107.  
  108.    Responses to certain commands are multi-line.  In these cases, which
  109.    are clearly indicated below, after sending the first line of the
  110.    response and a CRLF, any additional lines are sent, each terminated
  111.  
  112.  
  113.  
  114. Rose                                                            [Page 2]
  115.  
  116. RFC 1460                          POP3                         June 1993
  117.  
  118.  
  119.    by a CRLF pair.  When all lines of the response have been sent, a
  120.    final line is sent, consisting of a termination octet (decimal code
  121.    046, ".") and a CRLF pair.  If any line of the multi-line response
  122.    begins with the termination octet, the line is "byte-stuffed" by
  123.    pre-pending the termination octet to that line of the response.
  124.  
  125.    Hence a multi-line response is terminated with the five octets
  126.    "CRLF.CRLF".  When examining a multi-line response, the client checks
  127.    to see if the line begins with the termination octet.  If so and if
  128.    octets other than CRLF follow, the the first octet of the line (the
  129.    termination octet) is stripped away.  If so and if CRLF immediately
  130.    follows the termination character, then the response from the POP
  131.    server is ended and the line containing ".CRLF" is not considered
  132.    part of the multi-line response.
  133.  
  134.    A POP3 session progresses through a number of states during its
  135.    lifetime.  Once the TCP connection has been opened and the POP3
  136.    server has sent the greeting, the session enters the AUTHORIZATION
  137.    state.  In this state, the client must identify itself to the POP3
  138.    server.  Once the client has successfully done this, the server
  139.    acquires resources associated with the client's maildrop, and the
  140.    session enters the TRANSACTION state.  In this state, the client
  141.    requests actions on the part of the POP3 server.  When the client has
  142.    finished its transactions, the session enters the UPDATE state.  In
  143.    this state, the POP3 server releases any resources acquired during
  144.    the TRANSACTION state and says goodbye.  The TCP connection is then
  145.    closed.
  146.  
  147. 4. The AUTHORIZATION State
  148.  
  149.    Once the TCP connection has been opened by a POP3 client, the POP3
  150.    server issues a one line greeting.  This can be any string terminated
  151.    by CRLF.  An example might be:
  152.  
  153.       S.  +OK POP3 server ready
  154.  
  155.    Note that this greeting is a POP3 reply.  The POP3 server should
  156.    always give a positive response as the greeting.
  157.  
  158.    The POP3 session is now in the AUTHORIZATION state.  The client must
  159.    now issue the USER command.  If the POP3 server responds with a
  160.    positive success indicator ("+OK"), then the client may issue either
  161.    the PASS command to complete the authorization, or the QUIT command
  162.    to terminate the POP3 session.  If the POP3 server responds with a
  163.    negative success indicator ("-ERR") to the USER command, then the
  164.    client may either issue a new USER command or may issue the QUIT
  165.    command.
  166.  
  167.  
  168.  
  169.  
  170. Rose                                                            [Page 3]
  171.  
  172. RFC 1460                          POP3                         June 1993
  173.  
  174.  
  175.    When the client issues the PASS command, the POP3 server uses the
  176.    argument pair from the USER and PASS commands to determine if the
  177.    client should be given access to the appropriate maildrop.  If so,
  178.    the POP3 server then acquires an exclusive-access lock on the
  179.    maildrop.  If the lock is successfully acquired, the POP3 server
  180.    parses the maildrop into individual messages (read note below),
  181.    determines the last message (if any) present in the maildrop that was
  182.    referenced by the RETR command, and responds with a positive success
  183.    indicator.  The POP3 session now enters the TRANSACTION state.  If
  184.    the lock can not be acquired or the client should is denied access to
  185.    the appropriate maildrop or the maildrop can't be parsed for some
  186.    reason, the POP3 server responds with a negative success indicator.
  187.    (If a lock was acquired but the POP3 server intends to respond with a
  188.    negative success indicator, the POP3 server must release the lock
  189.    prior to rejecting the command.)  At this point, the client may
  190.    either issue a new USER command and start again, or the client may
  191.    issue the QUIT command.
  192.  
  193.                  NOTE: Minimal implementations of the POP3 need only be
  194.                  able to break a maildrop into its component messages;
  195.                  they need NOT be able to parse individual messages.
  196.                  More advanced implementations may wish to have this
  197.                  capability, for reasons discussed later.
  198.  
  199.    After the POP3 server has parsed the maildrop into individual
  200.    messages, it assigns a message-id to each message, and notes the size
  201.    of the message in octets.  The first message in the maildrop is
  202.    assigned a message-id of "1", the second is assigned "2", and so on,
  203.    so that the n'th message in a maildrop is assigned a message-id of
  204.    "n".  In POP3 commands and responses, all message-id's and message
  205.    sizes are expressed in base-10 (i.e., decimal).
  206.  
  207.    It sets the "highest number accessed" to be that of the last message
  208.    referenced by the RETR command.
  209.  
  210.    Here are summaries for the three POP3 commands discussed thus far:
  211.  
  212.            USER name
  213.                Arguments: a server specific user-id (required)
  214.                Restrictions: may only be given in the AUTHORIZATION
  215.                    state after the POP3 greeting or after an
  216.                    unsuccessful USER or PASS command
  217.                Possible Responses:
  218.                    +OK name is welcome here
  219.                    -ERR never heard of name
  220.                Examples:
  221.                    C:    USER mrose
  222.                    S:    +OK mrose is a real hoopy frood
  223.  
  224.  
  225.  
  226. Rose                                                            [Page 4]
  227.  
  228. RFC 1460                          POP3                         June 1993
  229.  
  230.  
  231.                      ...
  232.                    C:    USER frated
  233.                    S:    -ERR sorry, frated doesn't get his mail here
  234.  
  235.            PASS string
  236.                Arguments: a server/user-id specific password (required)
  237.                Restrictions: may only be given in the AUTHORIZATION
  238.                    state after a successful USER command
  239.                Possible Responses:
  240.                    +OK maildrop locked and ready
  241.                    -ERR invalid password
  242.                    -ERR unable to lock maildrop
  243.                Examples:
  244.                    C:    USER mrose
  245.                    S:    +OK mrose is a real hoopy frood
  246.                    C:    PASS secret
  247.                    S:    +OK mrose's maildrop has 2 messages
  248.                          (320 octets)
  249.                      ...
  250.                    C:    USER mrose
  251.                    S:    +OK mrose is a real hoopy frood
  252.                    C:    PASS secret
  253.                    S:    -ERR unable to lock mrose's maildrop, file
  254.                          already locked
  255.  
  256.            QUIT
  257.                Arguments: none
  258.                Restrictions: none
  259.                Possible Responses:
  260.                    +OK
  261.                Examples:
  262.                    C:    QUIT
  263.                    S:    +OK dewey POP3 server signing off
  264.  
  265. 5. The TRANSACTION State
  266.  
  267.    Once the client has successfully identified itself to the POP3 server
  268.    and the POP3 server has locked and burst the appropriate maildrop,
  269.    the POP3 session is now in the TRANSACTION state.  The client may now
  270.    issue any of the following POP3 commands repeatedly.  After each
  271.    command, the POP3 server issues a response.  Eventually, the client
  272.    issues the QUIT command and the POP3 session enters the UPDATE state.
  273.  
  274.    Here are the POP3 commands valid in the TRANSACTION state:
  275.  
  276.            STAT
  277.                Arguments: none
  278.                Restrictions: may only be given in the TRANSACTION state.
  279.  
  280.  
  281.  
  282. Rose                                                            [Page 5]
  283.  
  284. RFC 1460                          POP3                         June 1993
  285.  
  286.  
  287.                Discussion:
  288.  
  289.                  The POP3 server issues a positive response with a line
  290.                  containing information for the maildrop.  This line is
  291.                  called a "drop listing" for that maildrop.
  292.  
  293.                  In order to simplify parsing, all POP3 servers are
  294.                  required to use a certain format for drop listings.
  295.                  The first octets present must indicate the number of
  296.                  messages in the maildrop.  Following this is the size
  297.                  of the maildrop in octets.  This memo makes no
  298.                  requirement on what follows the maildrop size.
  299.                  Minimal implementations should just end that line of
  300.                  the response with a CRLF pair.  More advanced
  301.                  implementations may include other information.
  302.  
  303.                       NOTE: This memo STRONGLY discourages
  304.                       implementations from supplying additional
  305.                       information in the drop listing.  Other,
  306.                       optional, facilities are discussed later on
  307.                       which permit the client to parse the messages
  308.                       in the maildrop.
  309.  
  310.                  Note that messages marked as deleted are not counted in
  311.                  either total.
  312.  
  313.                Possible Responses:
  314.                    +OK nn mm
  315.                Examples:
  316.                    C:    STAT
  317.                    S:    +OK 2 320
  318.  
  319.            LIST [msg]
  320.                Arguments: a message-id (optionally)  If a message-id is
  321.                    given, it may NOT refer to a message marked as
  322.                    deleted.
  323.                Restrictions: may only be given in the TRANSACTION state.
  324.                Discussion:
  325.  
  326.                  If an argument was given and the POP3 server issues a
  327.                  positive response with a line containing information
  328.                  for that message.  This line is called a "scan listing"
  329.                  for that message.
  330.  
  331.                  If no argument was given and the POP3 server issues a
  332.                  positive response, then the response given is
  333.                  multi-line.  After the initial +OK, for each message
  334.                  in the maildrop, the POP3 server responds with a line
  335.  
  336.  
  337.  
  338. Rose                                                            [Page 6]
  339.  
  340. RFC 1460                          POP3                         June 1993
  341.  
  342.  
  343.                  containing information for that message.  This line
  344.                  is called a "scan listing" for that message.
  345.  
  346.                  In order to simplify parsing, all POP3 servers are
  347.                  required to use a certain format for scan listings.
  348.                  The first octets present must be the message-id of
  349.                  the message.  Following the message-id is the size of
  350.                  the message in octets.  This memo makes no requirement
  351.                  on what follows the message size in the scan listing.
  352.                  Minimal implementations should just end that line of
  353.                  the response with a CRLF pair.  More advanced
  354.                  implementations may include other information, as
  355.                  parsed from the message.
  356.  
  357.                       NOTE: This memo STRONGLY discourages
  358.                       implementations from supplying additional
  359.                       information in the scan listing.  Other, optional,
  360.                       facilities are discussed later on which permit
  361.                       the client to parse the messages in the maildrop.
  362.  
  363.                  Note that messages marked as deleted are not listed.
  364.  
  365.                Possible Responses:
  366.                    +OK scan listing follows
  367.                    -ERR no such message
  368.                Examples:
  369.                    C:    LIST
  370.                    S:    +OK 2 messages (320 octets)
  371.                    S:    1 120
  372.                    S:    2 200
  373.                    S:    .
  374.                      ...
  375.                    C:    LIST 2
  376.                    S:    +OK 2 200
  377.                      ...
  378.                    C:    LIST 3
  379.                    S:    -ERR no such message, only 2 messages in
  380.                          maildrop
  381.  
  382.            RETR msg
  383.                Arguments: a message-id (required)  This message-id may
  384.                    NOT refer to a message marked as deleted.
  385.                Restrictions: may only be given in the TRANSACTION state.
  386.                Discussion:
  387.  
  388.                  If the POP3 server issues a positive response, then the
  389.                  response given is multi-line.  After the initial +OK,
  390.                  the POP3 server sends the message corresponding to the
  391.  
  392.  
  393.  
  394. Rose                                                            [Page 7]
  395.  
  396. RFC 1460                          POP3                         June 1993
  397.  
  398.  
  399.                  given message-id, being careful to byte-stuff the
  400.                  termination character (as with all multi-line
  401.                  responses).
  402.  
  403.                  If the number associated with this message is higher
  404.                  than the "highest number accessed" in the maildrop, the
  405.                  POP3 server updates the "highest number accessed" to
  406.                  the number associated with this message.
  407.  
  408.                Possible Responses:
  409.                    +OK message follows
  410.                    -ERR no such message
  411.                Examples:
  412.                    C:    RETR 1
  413.                    S:    +OK 120 octets
  414.                    S:    <the POP3 server sends the entire message here>
  415.                    S:    .
  416.  
  417.            DELE msg
  418.                Arguments: a message-id (required)  This message-id
  419.                    may NOT refer to a message marked as deleted.
  420.                Restrictions: may only be given in the TRANSACTION state.
  421.                Discussion:
  422.  
  423.                  The POP3 server marks the message as deleted.  Any
  424.                  future reference to the message-id associated with the
  425.                  message in a POP3 command generates an error.  The POP3
  426.                  server does not actually delete the message until the
  427.                  POP3 session enters the UPDATE state.
  428.  
  429.                  If the number associated with this message is higher
  430.                  than the "highest number accessed" in the maildrop,
  431.                  the POP3 server updates the "highest number accessed"
  432.                  to the number associated with this message.
  433.  
  434.                Possible Responses:
  435.                    +OK message deleted
  436.                    -ERR no such message
  437.                Examples:
  438.                    C:    DELE 1
  439.                    S:    +OK message 1 deleted
  440.                      ...
  441.                    C:    DELE 2
  442.                    S:    -ERR message 2 already deleted
  443.  
  444.            NOOP
  445.                Arguments: none
  446.                Restrictions: may only be given in the TRANSACTION state.
  447.  
  448.  
  449.  
  450. Rose                                                            [Page 8]
  451.  
  452. RFC 1460                          POP3                         June 1993
  453.  
  454.  
  455.                Discussion:
  456.  
  457.                  The POP3 server does nothing, it merely replies with a
  458.                  positive response.
  459.  
  460.                Possible Responses:
  461.                    +OK
  462.                Examples:
  463.                    C:    NOOP
  464.                    S:    +OK
  465.  
  466.            LAST
  467.                Arguments: none
  468.                Restrictions: may only be issued in the TRANSACTION state.
  469.                Discussion:
  470.  
  471.                  The POP3 server issues a positive response with a line
  472.                  containing the highest message number which accessed.
  473.                  Zero is returned in case no message in the maildrop has
  474.                  been accessed during previous transactions.  A client
  475.                  may thereafter infer that messages, if any, numbered
  476.                  greater than the response to the LAST command are
  477.                  messages not yet accessed by the client.
  478.  
  479.              Possible Response:
  480.                    +OK nn
  481.  
  482.              Examples:
  483.                    C:      STAT
  484.                    S:      +OK 4 320
  485.                    C:      LAST
  486.                    S:      +OK 1
  487.                    C:      RETR 3
  488.                    S:      +OK 120 octets
  489.                    S:      <the POP3 server sends the entire message
  490.                            here>
  491.                    S:      .
  492.                    C:      LAST
  493.                    S:      +OK 3
  494.                    C:      DELE 2
  495.                    S:      +OK message 2 deleted
  496.                    C:      LAST
  497.                    S:      +OK 3
  498.                    C:      RSET
  499.                    S:      +OK
  500.                    C:      LAST
  501.                    S:      +OK 0
  502.  
  503.  
  504.  
  505.  
  506. Rose                                                            [Page 9]
  507.  
  508. RFC 1460                          POP3                         June 1993
  509.  
  510.  
  511.            RSET
  512.                Arguments: none
  513.                Restrictions: may only be given in the TRANSACTION
  514.                    state.
  515.                Discussion:
  516.  
  517.                  If any messages have been marked as deleted by the POP3
  518.                  server, they are unmarked.  The POP3 server then
  519.                  replies with a positive response.  In addition, the
  520.                  "highest number accessed" is also reset to zero.
  521.  
  522.                Possible Responses:
  523.                    +OK
  524.                Examples:
  525.                    C:    RSET
  526.                    S:    +OK maildrop has 2 messages (320 octets)
  527.  
  528. 6. The UPDATE State
  529.  
  530.    When the client issues the QUIT command from the TRANSACTION state,
  531.    the POP3 session enters the UPDATE state.  (Note that if the client
  532.    issues the QUIT command from the AUTHORIZATION state, the POP3
  533.    session terminates but does NOT enter the UPDATE state.)
  534.  
  535.            QUIT
  536.                Arguments: none
  537.                Restrictions: none
  538.                Discussion:
  539.  
  540.                  The POP3 server removes all messages marked as deleted
  541.                  from the maildrop.  It then releases the
  542.                  exclusive-access lock on the maildrop and replies as
  543.                  to the success of these operations.  The TCP
  544.                  connection is then closed.
  545.  
  546.                Possible Responses:
  547.                    +OK
  548.                Examples:
  549.                    C:    QUIT
  550.                    S:    +OK dewey POP3 server signing off (maildrop
  551.                          empty)
  552.                      ...
  553.                    C:    QUIT
  554.                    S:    +OK dewey POP3 server signing off (2 messages
  555.                          left)
  556.                      ...
  557.  
  558.  
  559.  
  560.  
  561.  
  562. Rose                                                           [Page 10]
  563.  
  564. RFC 1460                          POP3                         June 1993
  565.  
  566.  
  567. 7. Optional POP3 Commands
  568.  
  569.    The POP3 commands discussed above must be supported by all minimal
  570.    implementations of POP3 servers.
  571.  
  572.    The optional POP3 commands described below permit a POP3 client
  573.    greater freedom in message handling, while preserving a simple POP3
  574.    server implementation.
  575.  
  576.                  NOTE: This memo STRONGLY encourages implementations to
  577.                  support these commands in lieu of developing augmented
  578.                  drop and scan listings.  In short, the philosophy of
  579.                  this memo is to put intelligence in the part of the
  580.                  POP3 client and not the POP3 server.
  581.  
  582.            TOP msg n
  583.                Arguments: a message-id (required) and a number.  This
  584.                    message-id may NOT refer to a message marked as
  585.                    deleted.
  586.                Restrictions: may only be given in the TRANSACTION state.
  587.                Discussion:
  588.  
  589.                  If the POP3 server issues a positive response, then
  590.                  the response given is multi-line.  After the initial
  591.                  +OK, the POP3 server sends the headers of the message,
  592.                  the blank line separating the headers from the body,
  593.                  and then the number of lines indicated message's body,
  594.                  being careful to byte-stuff the termination character
  595.                  (as with all multi-line responses).
  596.  
  597.                  Note that if the number of lines requested by the POP3
  598.                  client is greater than than the number of lines in the
  599.                  body, then the POP3 server sends the entire message.
  600.  
  601.                Possible Responses:
  602.                    +OK top of message follows
  603.                    -ERR no such message
  604.                Examples:
  605.                    C:    TOP 10
  606.                    S:    +OK
  607.                    S:    <the POP3 server sends the headers of the
  608.                           message, a blank line, and the first 10 lines
  609.                           of the body of the message>
  610.                    S:    .
  611.                      ...
  612.                    C:    TOP 100
  613.                    S:    -ERR no such message
  614.  
  615.  
  616.  
  617.  
  618. Rose                                                           [Page 11]
  619.  
  620. RFC 1460                          POP3                         June 1993
  621.  
  622.  
  623.            APOP name digest
  624.                Arguments: a server specific user-id and a digest string
  625.                     (both required).
  626.                Restrictions: may only be given in the AUTHORIZATION
  627.                    state after the POP3 greeting
  628.                Discussion:
  629.  
  630.                  Normally, each POP3 session starts with a USER/PASS
  631.                  exchange.  This results in a server/user-id specific
  632.                  password being sent in the clear on the network.  For
  633.                  intermittent use of POP3, this may not introduce a
  634.                  sizable risk.  However, many POP3 client
  635.                  implementations connect to the POP3 server on a
  636.                  regular basis -- to check for new mail.  Further the
  637.                  interval of session initiation may be on the order of
  638.                  five minutes.  Hence, the risk of password capture is
  639.                  greatly enhanced.
  640.  
  641.                  An alternate method of authentication is required
  642.                  which provides for both origin authentication and
  643.                  replay protection, but which does not involve sending
  644.                  a password in the clear over the network.  The APOP
  645.                  command provides this functionality.
  646.  
  647.                  A POP3 server which implements the APOP command will
  648.                  include a timestamp in its banner greeting.  The
  649.                  syntax of the timestamp corresponds to the "msg-id"
  650.                  in [RFC822], and MUST be different each time the POP3
  651.                  server issues a banner greeting.  For example, on a
  652.                  UNIX implementation in which a separate UNIX process
  653.                  is used for each instance of a POP3 server, the
  654.                  syntax of the timestamp might be:
  655.  
  656.                     <process-ID.clock@hostname>
  657.  
  658.                  where "process-ID" is the decimal value of the
  659.                  process's PID, clock is the decimal value of the
  660.                  system clock, and hostname is the fully-qualified
  661.                  domain-name corresponding to the host where the POP3
  662.                  server is running.
  663.  
  664.                  The POP3 client makes note of this timestamp, and
  665.                  then issues the APOP command.  The "name" parameter
  666.                  has identical semantics to the "name" parameter of
  667.                  the USER command. The "digest" parameter is
  668.                  calculated by applying the MD5 algorithm [RFC1321] to
  669.                  a string consisting of the timestamp (including
  670.                  angle-brackets) followed by a shared secret.  This
  671.  
  672.  
  673.  
  674. Rose                                                           [Page 12]
  675.  
  676. RFC 1460                          POP3                         June 1993
  677.  
  678.  
  679.                  shared secret is a string known only to the POP3
  680.                  client and server. Great care should be taken to
  681.                  prevent unauthorized disclosure of the secret, as
  682.                  knowledge of the secret will allow any entity to
  683.                  successfully masquerade as the named user.  The
  684.                  "digest" parameter itself is a 16-octet value which
  685.                  is sent in hexadecimal format, using lower-case ASCII
  686.                  characters.
  687.  
  688.                  When the POP3 server receives the APOP command, it
  689.                  verifies the digest provided.  If the digest is
  690.                  correct, the POP3 server issues a positive response,
  691.                  and the POP3 session enters the TRANSACTION state.
  692.                  Otherwise, a negative response is issued and the POP3
  693.                  session remains in the AUTHORIZATION state.
  694.  
  695.                Possible Responses:
  696.                    +OK maildrop locked and ready
  697.                    -ERR permission denied
  698.                Examples:
  699.                    S: +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>
  700.                    C: APOP mrose c4c9334bac560ecc979e58001b3e22fb
  701.                    S: +OK maildrop has 1 message (369 octets)
  702.  
  703.                  In this example, the shared secret is the string "tanstaaf".
  704.                  Hence, the MD5 algorithm is applied to the string
  705.  
  706.                     <1896.697170952@dbc.mtview.ca.us>tanstaaf
  707.  
  708.                  which produces a digest value of
  709.  
  710.                     c4c9334bac560ecc979e58001b3e22fb
  711.  
  712. 8. POP3 Command Summary
  713.  
  714.        Minimal POP3 Commands:
  715.            USER name               valid in the AUTHORIZATION state
  716.            PASS string
  717.            QUIT
  718.  
  719.            STAT                    valid in the TRANSACTION state
  720.            LIST [msg]
  721.            RETR msg
  722.            DELE msg
  723.            NOOP
  724.            LAST
  725.            RSET
  726.  
  727.  
  728.  
  729.  
  730. Rose                                                           [Page 13]
  731.  
  732. RFC 1460                          POP3                         June 1993
  733.  
  734.  
  735.            QUIT                    valid in the UPDATE state
  736.  
  737.        Optional POP3 Commands:
  738.            APOP name digest        valid in the AUTHORIZATION state
  739.  
  740.            TOP msg n               valid in the TRANSACTION state
  741.  
  742.        POP3 Replies:
  743.            +OK
  744.            -ERR
  745.  
  746.        Note that with the exception of the STAT command, the reply given
  747.        by the POP3 server to any command is significant only to "+OK"
  748.        and "-ERR".  Any text occurring after this reply may be ignored
  749.        by the client.
  750.  
  751. 9. Example POP3 Session
  752.  
  753.     S: <wait for connection on TCP port 110>
  754.         ...
  755.     C: <open connection>
  756.     S:    +OK POP3 server ready <1896.697170952@dbc.mtview.ca.us>
  757.     C:    APOP mrose c4c9334bac560ecc979e58001b3e22fb
  758.     S:    +OK mrose's maildrop has 2 messages (320 octets)
  759.     C:    STAT
  760.     S:    +OK 2 320
  761.     C:    LIST
  762.     S:    +OK 2 messages (320 octets)
  763.     S:    1 120
  764.     S:    2 200
  765.     S:    .
  766.     C:    RETR 1
  767.     S:    +OK 120 octets
  768.     S:    <the POP3 server sends message 1>
  769.     S:    .
  770.     C:    DELE 1
  771.     S:    +OK message 1 deleted
  772.     C:    RETR 2
  773.     S:    +OK 200 octets
  774.     S:    <the POP3 server sends message 2>
  775.     S:    .
  776.     C:    DELE 2
  777.     S:    +OK message 2 deleted
  778.     C:    QUIT
  779.     S:    +OK dewey POP3 server signing off (maildrop empty)
  780.     C:  <close connection>
  781.     S:  <wait for next connection>
  782.  
  783.  
  784.  
  785.  
  786. Rose                                                           [Page 14]
  787.  
  788. RFC 1460                          POP3                         June 1993
  789.  
  790.  
  791. 10. Message Format
  792.  
  793.    All messages transmitted during a POP3 session are assumed to conform
  794.    to the standard for the format of Internet text messages [RFC822].
  795.  
  796.    It is important to note that the byte count for a message on the
  797.    server host may differ from the octet count assigned to that message
  798.    due to local conventions for designating end-of-line.  Usually,
  799.    during the AUTHORIZATION state of the POP3 session, the POP3 client
  800.    can calculate the size of each message in octets when it parses the
  801.    maildrop into messages.  For example, if the POP3 server host
  802.    internally represents end-of-line as a single character, then the
  803.    POP3 server simply counts each occurrence of this character in a
  804.    message as two octets.  Note that lines in the message which start
  805.    with the termination octet need not be counted twice, since the POP3
  806.    client will remove all byte-stuffed termination characters when it
  807.    receives a multi-line response.
  808.  
  809. 11. The POP and the Split-UA model
  810.  
  811.    The underlying paradigm in which the POP3 functions is that of a
  812.    split-UA model.  The POP3 client host, being a remote PC based
  813.    workstation, acts solely as a client to the message transport system.
  814.    It does not provide delivery/authentication services to others.
  815.    Hence, it is acting as a UA, on behalf of the person using the
  816.    workstation.  Furthermore, the workstation uses SMTP to enter mail
  817.    into the MTS.
  818.  
  819.    In this sense, we have two UA functions which interface to the
  820.    message transport system: Posting (SMTP) and Retrieval (POP3).  The
  821.    entity which supports this type of environment is called a split-UA
  822.    (since the user agent is split between two hosts which must
  823.    interoperate to provide these functions).
  824.  
  825.                  ASIDE:  Others might term this a remote-UA instead.
  826.                  There are arguments supporting the use of both terms.
  827.  
  828.    This memo has explicitly referenced TCP as the underlying transport
  829.    agent for the POP3.  This need not be the case.  In the MZnet split-
  830.    UA, for example, personal micro-computer systems are used which do
  831.    not have IP-style networking capability [MZnet].  To connect to the
  832.    POP3 server host, a PC establishes a terminal connection using some
  833.    simple protocol (PhoneNet).  A program on the PC drives the
  834.    connection, first establishing a login session as a normal user.  The
  835.    login shell for this pseudo-user is a program which drives the other
  836.    half of the terminal protocol and communicates with one of two
  837.    servers.  Although MZnet can support several PCs, a single pseudo-
  838.    user login is present on the server host.  The user-id and password
  839.  
  840.  
  841.  
  842. Rose                                                           [Page 15]
  843.  
  844. RFC 1460                          POP3                         June 1993
  845.  
  846.  
  847.    for this pseudo-user login is known to all members of MZnet.  Hence,
  848.    the first action of the login shell, after starting the terminal
  849.    protocol, is to demand a USER/PASS authorization pair from the PC.
  850.    This second level of authorization is used to ascertain who is
  851.    interacting with the MTS.  Although the server host is deemed to
  852.    support a "trusted" MTS entity, PCs in MZnet are not.  Naturally, the
  853.    USER/PASS authorization pair for a PC is known only to the owner of
  854.    the PC (in theory, at least).
  855.  
  856.    After successfully verifying the identity of the client, a modified
  857.    SMTP server is started, and the PC posts mail with the server host.
  858.    After the QUIT command is given to the SMTP server and it terminates,
  859.    a modified POP3 server is started, and the PC retrieves mail from the
  860.    server host.  After the QUIT command is given to the POP3 server and
  861.    it terminates, the login shell for the pseudo-user terminates the
  862.    terminal protocol and logs the job out.  The PC then closes the
  863.    terminal connection to the server host.
  864.  
  865.    The SMTP server used by MZnet is modified in the sense that it knows
  866.    that it's talking to a user agent and not a "trusted" entity in the
  867.    message transport system.  Hence, it does performs the validation
  868.    activities normally performed by an entity in the MTS when it accepts
  869.    a message from a UA.
  870.  
  871.    The POP3 server used by MZnet is modified in the sense that it does
  872.    not require a USER/PASS combination before entering the TRANSACTION
  873.    state.  The reason for this (of course) is that the PC has already
  874.    identified itself during the second-level authorization step
  875.    described above.
  876.  
  877.                  NOTE: Truth in advertising laws require that the author
  878.                  of this memo state that MZnet has not actually been
  879.                  fully implemented.  The concepts presented and proven
  880.                  by the project led to the notion of the MZnet
  881.                  split-slot model.  This notion has inspired the
  882.                  split-UA concept described in this memo, led to the
  883.                  author's interest in the POP, and heavily influenced
  884.                  the the description of the POP3 herein.
  885.  
  886.    In fact, some UAs present in the Internet already support the notion
  887.    of posting directly to an SMTP server and retrieving mail directly
  888.    from a POP3 server, even if the POP3 server and client resided on the
  889.    same host!
  890.  
  891.                  ASIDE: this discussion raises an issue which this memo
  892.                  purposedly avoids: how does SMTP know that it's talking
  893.                  to a "trusted" MTS entity?
  894.  
  895.  
  896.  
  897.  
  898. Rose                                                           [Page 16]
  899.  
  900. RFC 1460                          POP3                         June 1993
  901.  
  902.  
  903. 12. References
  904.  
  905.    [MZnet]   Stefferud, E., Sweet, J., and T. Domae, "MZnet: Mail
  906.              Service for Personal Micro-Computer Systems,:
  907.              Proceedings, IFIP 6.5 International Conference on
  908.              Computer Message Systems, Nottingham, U.K., May 1984.
  909.  
  910.    [RFC821]  Postel, J., "Simple Mail Transfer Protocol", STD 10,
  911.              RFC 821, USC/Information Sciences Institute, August 1982.
  912.  
  913.    [RFC822]  Crocker, D., "Standard for the Format of ARPA-Internet
  914.              Text Messages", STD 11, RFC 822, University of Delaware,
  915.              August 1982.
  916.  
  917.    [RFC1321] Rivest, R. "The MD5 Message-Digest Algorithm", MIT
  918.              Laboratory for Computer Science, April 1992.
  919.  
  920. 13. Security Considerations
  921.  
  922.    It is conjectured that use of the APOP command provides origin
  923.    identification and replay protection for a POP3 session.
  924.    Accordingly, a POP3 server which implements both the PASS and APOP
  925.    commands must not allow both methods of access for a given user; that
  926.    is, for a given "USER name" either the PASS or APOP command is
  927.    allowed, but not both.
  928.  
  929.    Otherwise, security issues are not discussed in this memo.
  930.  
  931. 14. Acknowledgements
  932.  
  933.    The POP family has a long and checkered history.  Although primarily
  934.    a minor revision to [RFC1225], POP3 is based on the ideas presented
  935.    in RFCs 918, 937, and 1081.
  936.  
  937.    In addition, Alfred Grimstad, Keith McCloghrie, and Neil Ostroff
  938.    provided significant comments on the APOP command.
  939.  
  940. 15. Author's Address
  941.  
  942.    Marshall T. Rose
  943.    Dover Beach Consulting, Inc.
  944.    Mountain View, CA  94043-2186
  945.  
  946.    Phone: +1 415 968 1052
  947.    Fax:   +1 415 968 2510
  948.  
  949.    EMail: mrose@dbc.mtview.ca.us
  950.    X.500: rose, dbc, us
  951.  
  952.  
  953.  
  954. Rose                                                           [Page 17]
  955.