+2000-02-20  Kenichi OKADA  <okada@opaopa.org>
+
+       * elmo-imap4.el (elmo-network-authenticate-session): Fix.
+       * elmo-pop3.el (elmo-network-authenticate-session): Add comments.
+
 2001-02-20  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * Luna-fy Kenichi OKADA's following changes.
 
                (setq response
                      (elmo-imap4-read-untagged
                       (elmo-network-session-process-internal session)))
-               (if (elmo-imap4-response-continue-req-p response)
-                   (unless (sasl-next-step client step)
-                     ;; response is '+' but there's no next step.
-                     (signal 'elmo-authenticate-error
-                             (list (intern
-                                    (concat "elmo-imap4-auth-"
-                                            (downcase name))))))
-                 ;; response is OK.
-                 (if (elmo-imap4-response-ok-p response)
-                     (throw 'done nil) ; finished.
-                   ;; response is NO or BAD.
-                   (signal 'elmo-authenticate-error
-                           (list (intern
-                                  (concat "elmo-imap4-auth-"
-                                          (downcase name)))))))
+               (if (elmo-imap4-response-ok-p response)
+                   (if (sasl-next-step client step)
+                       ;; Bogus server?
+                       (signal 'elmo-authenticate-error
+                               (list (intern
+                                      (concat "elmo-imap4-auth-"
+                                              (downcase name)))))
+                     ;; The authentication process is finished.
+                     (throw 'done nil)))
+               (unless (elmo-imap4-response-continue-req-p response)
+                 ;; response is NO or BAD.
+                 (signal 'elmo-authenticate-error
+                         (list (intern
+                                (concat "elmo-imap4-auth-"
+                                        (downcase name))))))
                (sasl-step-set-data
                 step
                 (elmo-base64-decode-string
 
            (catch 'done
              (while t
                (unless (setq response (elmo-pop3-read-response process t))
+                 ;; response is NO or BAD.
                  (signal 'elmo-authenticate-error
                          (list (intern
                                 (concat "elmo-pop3-auth-"
                                         (downcase name))))))
                (if (string-match "^\+OK" response)
                    (if (sasl-next-step client step)
+                       ;; Bogus server?
                        (signal 'elmo-authenticate-error
                                (list (intern
                                       (concat "elmo-pop3-auth-"
                                               (downcase name)))))
+                     ;; The authentication process is finished.
                      (throw 'done nil)))
                (sasl-step-set-data
                 step