* elmo-net.el (elmo-network-session-password-key): Don't set default to 'plain.
authorteranisi <teranisi>
Tue, 9 Jan 2001 06:28:42 +0000 (06:28 +0000)
committerteranisi <teranisi>
Tue, 9 Jan 2001 06:28:42 +0000 (06:28 +0000)
* elmo-util.el (elmo-imap4-get-spec): Set default of auth to 'clear.
(elmo-pop3-get-spec): Set default of auth to 'user.

* elmo-imap4.el (elmo-imap4-clear-login): New function;
 Renamed from `elmo-imap4-login'.
(elmo-imap4-auth-login): New function; Revival.
(elmo-network-authenticate-session): Use `elmo-imap4-clear-login' and
`elmo-imap4-auth-login'.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-net.el
elmo/elmo-util.el

index f7b2f6f..70467b0 100644 (file)
@@ -1,7 +1,17 @@
 2001-01-09  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-net.el (elmo-network-session-password-key): Don't set default to
+       'plain.
+
+       * elmo-util.el (elmo-imap4-get-spec): Set default of auth to 'clear.
+       (elmo-pop3-get-spec): Set default of auth to 'user.
+
        * elmo-imap4.el (elmo-imap4-session-check):
        Clear `elmo-imap4-fetch-callback' and `elmo-imap4-fetch-callback-data'.
+       (elmo-imap4-clear-login): New function; Renamed from `elmo-imap4-login'.
+       (elmo-imap4-auth-login): New function; Revival.
+       (elmo-network-authenticate-session): Use `elmo-imap4-clear-login' and
+       `elmo-imap4-auth-login'.
 
 2000-12-29  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
index 84ed240..ba3c1af 100644 (file)
@@ -530,7 +530,7 @@ BUFFER must be a single-byte buffer."
                     elmo-default-imap4-user)
       (setq append-serv (concat ":" (elmo-imap4-spec-username spec))))
     (unless (eq (elmo-imap4-spec-auth spec)
-                    elmo-default-imap4-authenticate-type)
+               elmo-default-imap4-authenticate-type)
       (setq append-serv 
            (concat append-serv "/" (symbol-name (elmo-imap4-spec-auth spec)))))
     (unless (string= (elmo-imap4-spec-hostname spec)
@@ -1131,7 +1131,7 @@ If optional argument UNMARK is non-nil, unmark."
       (elmo-read
        (concat "(" (downcase (elmo-match-string 1 string)) ")"))))
 
-(defun elmo-imap4-login (session)
+(defun elmo-imap4-clear-login (session)
   (let ((elmo-imap4-debug-inhibit-logging t))
     (or
      (elmo-imap4-read-ok
@@ -1143,7 +1143,25 @@ If optional argument UNMARK is non-nil, unmark."
             " "
             (elmo-imap4-password
              (elmo-get-passwd (elmo-network-session-password-key session))))))
-     (signal 'elmo-authenticate-error '(login)))))
+     (signal 'elmo-authenticate-error '(elmo-imap4-clear-login)))))
+
+(defun elmo-imap4-auth-login (session)
+  (let ((tag (elmo-imap4-send-command session "authenticate login"))
+       (elmo-imap4-debug-inhibit-logging t))
+    (or (elmo-imap4-read-continue-req session)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (elmo-imap4-send-string session
+                           (elmo-base64-encode-string
+                            (elmo-network-session-user-internal session)))
+    (or (elmo-imap4-read-continue-req session)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (elmo-imap4-send-string session
+                           (elmo-base64-encode-string
+                            (elmo-get-passwd
+                             (elmo-network-session-password-key session))))
+    (or (elmo-imap4-read-ok session tag)
+       (signal 'elmo-authenticate-error '(elmo-imap4-auth-login)))
+    (setq elmo-imap4-status 'auth)))
   
 (luna-define-method
   elmo-network-initialize-session-buffer :after ((session
@@ -1196,8 +1214,12 @@ If optional argument UNMARK is non-nil, unmark."
           (auth (if (listp auth) auth (list auth))))
       (unless (or (eq elmo-imap4-status 'auth)
                  (null auth))
-       (if (eq 'plain (car auth))
-           (elmo-imap4-login session)
+       (cond
+        ((eq 'clear (car auth))
+         (elmo-imap4-clear-login session))
+        ((eq 'login (car auth))
+         (elmo-imap4-auth-login session))
+        (t
          (let* ((elmo-imap4-debug-inhibit-logging t)
                 (sasl-mechanisms
                  (delq nil
@@ -1286,8 +1308,8 @@ If optional argument UNMARK is non-nil, unmark."
                       (if (sasl-step-data step)
                           (elmo-base64-encode-string (sasl-step-data step)
                                                      'no-line-break)
-                        "")))))))))))
+                        ""))))))))))))
+
 (luna-define-method elmo-network-setup-session ((session
                                                 elmo-imap4-session))
   (with-current-buffer (elmo-network-session-buffer session)
index 0380a85..e97c9b2 100644 (file)
   (format "%s:%s/%s@%s:%d"
          (elmo-network-session-name-internal session)
          (elmo-network-session-user-internal session)
-         (symbol-name (or (elmo-network-session-auth-internal session)
-                          'plain))
+         (elmo-network-session-auth-internal session)
          (elmo-network-session-host-internal session)
          (elmo-network-session-port-internal session)))
 
index 2611cf4..fb8af11 100644 (file)
@@ -235,6 +235,7 @@ File content is encoded with MIME-CHARSET."
        (setq auth (if (match-beginning 4)
                       (intern (elmo-match-substring 4 folder 1))
                     elmo-default-imap4-authenticate-type))
+       (setq auth (or auth 'clear))
        (append (list 'imap4
                      (elmo-imap4-encode-folder-string mailbox)
                      user auth)
@@ -418,6 +419,7 @@ File content is encoded with MIME-CHARSET."
       (setq auth (if (match-beginning 3)
                     (intern (elmo-match-substring 3 folder 1))
                   elmo-default-pop3-authenticate-type))
+      (setq auth (or auth 'user))
       (append (list 'pop3 user auth)
              (cdr spec)))))