bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return u


From: Jun Hao
Subject: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
Date: Sat, 27 Feb 2016 15:52:24 +0800
User-agent: mu4e 0.9.16; emacs 24.5.1

Hi,

On OSX when calling auth-source-search to search from keychain with
account has '\' in it, the function doesn't return user info back but
only password. This patch is to fix smtpmail if for whatever reason
above situation happened.

Long term is to fix auth-source-search. Looks like it missed this case
in auth-source-macos-keychain-search-items. If account has '\' in it,
security will return something like:

"acct"<blob>=0x414E545C6A756E68616F  "ANT\134junhao"

instead of form current code expects:

"acct"<blob>="junhao"

Even auth-source-search is fixed, I still think this patch is nice
to have to make smtpmail more robust.

Thanks - Jun

>From 6306eddd9bf0fe3b47ea4139337792761d32a61b Mon Sep 17 00:00:00 2001
From: Jun Hao <address@hidden>
Date: Sat, 27 Feb 2016 15:01:35 +0800
Subject: [PATCH] Use default user if auth search doesn't return one

* smtpmail.el (smtpmail-try-auth-methods):Use smtpmail-smpt-user if
auth-source-search doesn't return user field

Copyright-paperwork-exempt: yes
---
 lisp/mail/smtpmail.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 8e0bb3a..be9807f 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -505,7 +505,7 @@ The list is in preference order.")
                      :require (and ask-for-password
                                    '(:user :secret))
                      :create ask-for-password)))
-         (user (plist-get auth-info :user))
+         (user (or (plist-get auth-info :user) smtpmail-smtp-user))
          (password (plist-get auth-info :secret))
         (save-function (and ask-for-password
                             (plist-get auth-info :save-function)))
-- 
2.7.2


reply via email to

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