#3862: Error in POP3 authentication via SASL mechanism DIGEST-MD5
-----------------------+----------------------
  Reporter:  g1pimutt  |      Owner:  mutt-dev
      Type:  defect    |     Status:  new
  Priority:  major     |  Milestone:
 Component:  POP       |    Version:
Resolution:            |   Keywords:
-----------------------+----------------------

Comment (by kevin8t8):

 Ah!  That's very interesting - I didn't realize the "client_start" case
 might set rc=SASL_OK.  So that explains the {{{if (!client_start && rc !=
 SASL_CONTINUE)}}} line too: it sends out the data returned from
 sasl_client_start() and then exits in the next loop because rc=SASL_OK.
 The code is really complicated, though, isn't it. :-)

 I think the code would have been clearer if they pulled the client_start
 out of the loop, even though this would have duplicated code.  Something
 like:

 {{{
 rc = sasl_client_start()

 buf = "AUTH <mech>"
 mutt_socket_write(buf)
 mutt_socket_readln(inbuf)

 if (client_start)
 {
   sasl_encode64(pc -> buf)
   mutt_socket_write(buf)
   mutt_socket_readln(inbuf)
 }

 while (rc == SASL_CONTINUE)
 {
   sasl_decode64(inbuf -> buf)
   rc = sasl_client_step()
   if (pc)
     sasl_encode64()
   append \r\n to buf
   mutt_socket_write(buf)
   mutt_socket_readln(inbuf)
 }
 }}}

 But obviously I would probably introduce more bugs if I touched the code
 that much.

 Okay, I will submit your second patch and close this ticket after I finish
 the 1.7.1 release.
 Thank you very much for the patch and for your time to help me understand.

--
Ticket URL: <https://dev.mutt.org/trac/ticket/3862#comment:13>
Mutt <http://www.mutt.org/>
The Mutt mail user agent

Reply via email to