*** imap.el.bak 2010-10-28 11:17:05.000000000 +0200 --- imap.el 2010-10-28 15:13:12.000000000 +0200 *************** *** 311,316 **** --- 311,317 ---- cram-md5 ;;sasl login + plain anonymous) "Priority of authenticators to consider when authenticating to server.") *************** *** 320,325 **** --- 321,327 ---- (sasl imap-sasl-auth-p imap-sasl-auth) (cram-md5 imap-cram-md5-p imap-cram-md5-auth) (login imap-login-p imap-login-auth) + (plain imap-plain-p imap-plain-auth) (anonymous imap-anonymous-p imap-anonymous-auth) (digest-md5 imap-digest-md5-p imap-digest-md5-auth)) "Definition of authenticators. *************** *** 948,953 **** --- 950,958 ---- (and (not (imap-capability 'LOGINDISABLED buffer)) (not (imap-capability 'X-LOGIN-CMD-DISABLED buffer)))) + (defun imap-plain-p (buffer) + t) + (defun imap-quote-specials (string) (with-temp-buffer (insert string) *************** *** 970,975 **** --- 975,993 ---- (imap-quote-specials passwd) "\"")))))) + (defun imap-plain-auth (buffer) + "Login to server using the PLAIN command." + (message "imap: Plaintext authentication PLAIN...") + (imap-interactive-login buffer + (lambda (user passwd) + (imap-ok-p (imap-send-command-wait + (concat "AUTHENTICATE PLAIN " + (base64-encode-string + (concat "\000" (imap-quote-specials user) + "\000" + (imap-quote-specials passwd) + )))))))) + (defun imap-anonymous-p (buffer) t) *************** *** 1236,1242 **** auth) (while (setq auth (pop auths)) ;; OK to use authenticator? ! (setq imap-last-authenticator (assq auth imap-authenticator-alist)) (when (funcall (nth 1 imap-last-authenticator) (current-buffer)) (message "imap: Authenticating to `%s' using `%s'..." --- 1254,1260 ---- auth) (while (setq auth (pop auths)) ;; OK to use authenticator? ! (setq imap-last-authenticator (assq auth imap-authenticator-alist)) (when (funcall (nth 1 imap-last-authenticator) (current-buffer)) (message "imap: Authenticating to `%s' using `%s'..." *************** *** 3013,3018 **** --- 3031,3038 ---- imap-cram-md5-auth imap-login-p imap-login-auth + imap-plain-p + imap-plain-auth imap-anonymous-p imap-anonymous-auth imap-open-1