GNU bug report logs - #22824
Use smtpmail-smtp-user if auth-source-search doesn't return user field

Previous Next

Package: emacs;

Reported by: Jun Hao <jun_hao <at> aol.com>

Date: Sat, 27 Feb 2016 08:27:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 26.1

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jun Hao <jun_hao <at> aol.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Use smtpmail-smtp-user if auth-source-search doesn't return user
 field 
Date: Sat, 27 Feb 2016 15:52:24 +0800
[Message part 1 (text/plain, inline)]
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

[0001-Use-default-user-if-auth-search-doesn-t-return-one.patch (text/x-patch, inline)]
From 6306eddd9bf0fe3b47ea4139337792761d32a61b Mon Sep 17 00:00:00 2001
From: Jun Hao <jun_hao <at> aol.com>
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


This bug report was last modified 8 years and 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.