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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22824 in the body.
You can then email your comments to 22824 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Sat, 27 Feb 2016 08:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jun Hao <jun_hao <at> aol.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Feb 2016 08:27:01 GMT) Full text and rfc822 format available.

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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Sun, 28 Feb 2016 05:33:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jun Hao <jun_hao <at> aol.com>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Sun, 28 Feb 2016 16:02:19 +1030
Jun Hao <jun_hao <at> aol.com> writes:

> 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.

Well, this is purely a bug in auth-source, so I think a workaround in
smtpmail.el would just be confusing.

What is that encoding of the user name that the MacOS keychain uses?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Sun, 28 Feb 2016 09:09:01 GMT) Full text and rfc822 format available.

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

From: Jun Hao <jun_hao <at> aol.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Sun, 28 Feb 2016 17:07:19 +0800
I'm working on fix auth-source-search. This is actually affecting any
field (including password) with these kind of symbols and non-ASCII chars. Will post a patch
once I'm done.

I think it's safe to assume what auth-source-search returns should match
smtpmail-smtp-user and no harm to fallback to it. But if you think it's
confusing, let's just drop this patch.

It's utf-8 encoded.

On 2016-02-28 at 13:32, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> Jun Hao <jun_hao <at> aol.com> writes:
>
>> 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.
>
> Well, this is purely a bug in auth-source, so I think a workaround in
> smtpmail.el would just be confusing.
>
> What is that encoding of the user name that the MacOS keychain uses?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Mon, 29 Feb 2016 02:24:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jun Hao <jun_hao <at> aol.com>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Mon, 29 Feb 2016 13:22:51 +1100
Jun Hao <jun_hao <at> aol.com> writes:

> I'm working on fix auth-source-search. This is actually affecting any
> field (including password) with these kind of symbols and non-ASCII
> chars. Will post a patch once I'm done.

Great!

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Wed, 02 Mar 2016 17:00:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jun Hao <jun_hao <at> aol.com>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Wed, 02 Mar 2016 16:58:34 +0000
Jun Hao <jun_hao <at> aol.com> writes:

> Please review this patch. I didn't find existing function to do the
> conversion so write a simple helper function to do it. Tested with slash
> and Chinese char in label, account and password field.

Looks good, I think...

[...]

> * auth-source.el (auth-source-macos-keychain-search-items): Handle
>   keychain output correctly when has special char. (Bug#22824)
>
> Copyright-paperwork-exempt: yes

[...]

> +  (defun* decode-octal-string (string)

The name here should be "auth-source-", though.

And the patch is longer than what we can accept without a copyright
assignment.  Would you be willing to sign such a thing?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Thu, 03 Mar 2016 16:55:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jun Hao <jun_hao <at> aol.com>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Thu, 03 Mar 2016 16:54:12 +0000
Jun Hao <jun_hao <at> aol.com> writes:

> Sure, can you give me a pointer where I can get and sign the form?

Send an email to assign <at> gnu.org asking for the form.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Thu, 03 Mar 2016 17:00:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Jun Hao <jun_hao <at> aol.com>, 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Thu, 03 Mar 2016 11:59:33 -0500
Lars Ingebrigtsen wrote:

> Jun Hao <jun_hao <at> aol.com> writes:
>
>> Sure, can you give me a pointer where I can get and sign the form?
>
> Send an email to assign <at> gnu.org asking for the form.

The initial form is at:

http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/Copyright/request-assign.future

Please follow the instructions in the form.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Sun, 24 Apr 2016 12:38:02 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Jun Hao" <jun_hao <at> aol.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Sun, 24 Apr 2016 14:37:44 +0200
"Jun Hao" <jun_hao <at> aol.com> writes:

> Just completed the form assignment. Please review the patch and let me
> know if I need to do anything else.

Hm.  I think there was an updated version of the patch posted, but it
seems to be missing from the debbugs archive?  Can you repost it?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Sun, 24 Apr 2016 12:44:01 GMT) Full text and rfc822 format available.

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

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: "Jun Hao" <jun_hao <at> aol.com>
Cc: 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Sun, 24 Apr 2016 14:43:44 +0200
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> "Jun Hao" <jun_hao <at> aol.com> writes:
>
>> Just completed the form assignment. Please review the patch and let me
>> know if I need to do anything else.
>
> Hm.  I think there was an updated version of the patch posted, but it
> seems to be missing from the debbugs archive?  Can you repost it?

Never mind, I found it in my own mailbox.

I've now applied it with some changes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 24 Apr 2016 12:44:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 22824 <at> debbugs.gnu.org and Jun Hao <jun_hao <at> aol.com> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 24 Apr 2016 12:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22824; Package emacs. (Mon, 25 Apr 2016 14:43:01 GMT) Full text and rfc822 format available.

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

From: "Jun Hao" <jun_hao <at> aol.com>
To: Lars Magne Ingebrigtsen <larsi <at> gnus.org>, 22824 <at> debbugs.gnu.org
Subject: Re: bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't
 return user field
Date: Mon, 25 Apr 2016 22:41:55 +0800
Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:

> Lars Magne Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> "Jun Hao" <jun_hao <at> aol.com> writes:
>>
>>> Just completed the form assignment. Please review the patch and let me
>>> know if I need to do anything else.
>>
>> Hm.  I think there was an updated version of the patch posted, but it
>> seems to be missing from the debbugs archive?  Can you repost it?
>
> Never mind, I found it in my own mailbox.
>
> I've now applied it with some changes.

Great! I tried it and works as expected. I find another small issue when
handling without port pass in. Will create another bug with patch

Thanks - Jun




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 May 2016 11:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:11 GMT) Full text and rfc822 format available.

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

Previous Next


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