[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

smtpmail.el: PLAIN authentication fails

From: Ralf Angeli
Subject: smtpmail.el: PLAIN authentication fails
Date: Mon, 05 Dec 2005 20:38:07 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

The SMTP PLAIN authentication mechanism doesn't seem to work in
smtpmail.el.  At least it didn't when I tried it with smtp.web.de.
Here is an SMTP trace (hostname and IP address obfuscated):

--8<---------------cut here---------------start------------->8---
220 smtp07.web.de ESMTP WEB.DE V4.105#333 Mon, 05 Dec 2005 20:10:04 +0100
EHLO my.host
250-smtp07.web.de Hello my.host [xxx.xxx.xxx.xxx]
250-SIZE 69920427
250 HELP
535 Incorrect authentication data
221 smtp07.web.de closing connection

Process SMTP deleted
--8<---------------cut here---------------end--------------->8---

I could not find an RFC describing exactly the syntax of the AUTH
command for PLAIN authentication but in all the examples I found on
the net the credentials are passed along with the "AUTH PLAIN"
string.  That means instead of "AUTH PLAIN" smtpmail.el should submit
"AUTH PLAIN <base64-encoded credentials>" to the server.

With the following change to smtpmail.el I could be authenticated at
the SMTP server and send a mail:

2005-12-05  Ralf Angeli  <address@hidden>

        * mail/smtpmail.el (smtpmail-try-auth-methods): Send
        credentials together with "AUTH PLAIN" command.  Use manually
        entered password for PLAIN authentication if respective
        element in `smtpmail-auth-credentials' is nil.

--8<---------------cut here---------------start------------->8---
--- /home/angeli/scratch/smtpmail.el~   2005-12-05 20:17:39.000000000 +0100
+++ /home/angeli/scratch/smtpmail.el    2005-12-05 20:18:46.000000000 +0100
@@ -560,16 +560,13 @@
                (>= (car ret) 400))
            (throw 'done nil)))
        ((eq mech 'plain)
-       (smtpmail-send-command process "AUTH PLAIN")
-       (if (or (null (car (setq ret (smtpmail-read-response process))))
-               (not (integerp (car ret)))
-               (not (equal (car ret) 334)))
-           (throw 'done nil))
-       (smtpmail-send-command process (base64-encode-string
+       (smtpmail-send-command process
+                              (concat "AUTH PLAIN "
+                                      (base64-encode-string
                                        (concat "\0"
                                                (smtpmail-cred-user cred)
-                                               (smtpmail-cred-passwd cred))))
+                                               passwd))))
        (if (or (null (car (setq ret (smtpmail-read-response process))))
                (not (integerp (car ret)))
                (not (equal (car ret) 235)))
--8<---------------cut here---------------end--------------->8---

Also note, that `passwd' is used in the string for the credentials
instead of `(smtpmail-cred-passwd cred)' which can be nil.  `passwd'
will contain the correct value in any case.

In GNU Emacs (i486-pc-linux-gnu, GTK+ Version 2.6.10)
 of 2005-12-02 on pacem, modified by Debian
configured using `configure '--build' 'i486-linux-gnu' '--host' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
 '--with-x=yes' '--with-x-toolkit=gtk' 'CFLAGS=-DDEBIAN -g -Wno-pointer-sign 
-O2' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  desktop-save-mode: t
  display-time-mode: t
  iswitchb-mode: t
  recentf-mode: t
  show-paren-mode: t
  encoded-kbd-mode: t
  auto-compression-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC x r e p o r t - e m TAB RET

Recent messages:
Loading recentf...done
Loading /home/angeli/.recentf...done
Cleaning up the recentf list...done (0 removed)
Loading iswitchb...done
Loading time...done
Loading desktop...done
No desktop file.
For information about the GNU Project and its goals, type C-h C-p.
Loading cl-seq...done
Loading emacsbug...done

reply via email to

[Prev in Thread] Current Thread [Next in Thread]