unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
@ 2016-02-27  7:52 Jun Hao
  2016-02-28  5:32 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Jun Hao @ 2016-02-27  7:52 UTC (permalink / raw)
  To: 22824

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-default-user-if-auth-search-doesn-t-return-one.patch --]
[-- Type: text/x-patch, Size: 1006 bytes --]

From 6306eddd9bf0fe3b47ea4139337792761d32a61b Mon Sep 17 00:00:00 2001
From: Jun Hao <jun_hao@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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-02-27  7:52 bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field Jun Hao
@ 2016-02-28  5:32 ` Lars Ingebrigtsen
  2016-02-28  9:07   ` Jun Hao
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-28  5:32 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

Jun Hao <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-02-28  5:32 ` Lars Ingebrigtsen
@ 2016-02-28  9:07   ` Jun Hao
  2016-02-29  2:22     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Jun Hao @ 2016-02-28  9:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 22824

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@gnus.org> wrote:
> Jun Hao <jun_hao@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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-02-28  9:07   ` Jun Hao
@ 2016-02-29  2:22     ` Lars Ingebrigtsen
       [not found]       ` <m2si09f19c.fsf@aol.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-29  2:22 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

Jun Hao <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
       [not found]       ` <m2si09f19c.fsf@aol.com>
@ 2016-03-02 16:58         ` Lars Ingebrigtsen
       [not found]           ` <m2k2ljfyuj.fsf@aol.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2016-03-02 16:58 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

Jun Hao <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
       [not found]           ` <m2k2ljfyuj.fsf@aol.com>
@ 2016-03-03 16:54             ` Lars Ingebrigtsen
  2016-03-03 16:59               ` Glenn Morris
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2016-03-03 16:54 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

Jun Hao <jun_hao@aol.com> writes:

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

Send an email to assign@gnu.org asking for the form.

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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-03-03 16:54             ` Lars Ingebrigtsen
@ 2016-03-03 16:59               ` Glenn Morris
       [not found]                 ` <m2mvqegwtu.fsf@aol.com>
  0 siblings, 1 reply; 10+ messages in thread
From: Glenn Morris @ 2016-03-03 16:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Jun Hao, 22824

Lars Ingebrigtsen wrote:

> Jun Hao <jun_hao@aol.com> writes:
>
>> Sure, can you give me a pointer where I can get and sign the form?
>
> Send an email to assign@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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
       [not found]                   ` <m2bn5d7fjw.fsf@aol.com>
@ 2016-04-24 12:37                     ` Lars Magne Ingebrigtsen
  2016-04-24 12:43                       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-04-24 12:37 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

"Jun Hao" <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-04-24 12:37                     ` Lars Magne Ingebrigtsen
@ 2016-04-24 12:43                       ` Lars Magne Ingebrigtsen
  2016-04-25 14:41                         ` Jun Hao
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-04-24 12:43 UTC (permalink / raw)
  To: Jun Hao; +Cc: 22824

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> "Jun Hao" <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field
  2016-04-24 12:43                       ` Lars Magne Ingebrigtsen
@ 2016-04-25 14:41                         ` Jun Hao
  0 siblings, 0 replies; 10+ messages in thread
From: Jun Hao @ 2016-04-25 14:41 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen, 22824


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
>
>> "Jun Hao" <jun_hao@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





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-04-25 14:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-27  7:52 bug#22824: Use smtpmail-smtp-user if auth-source-search doesn't return user field Jun Hao
2016-02-28  5:32 ` Lars Ingebrigtsen
2016-02-28  9:07   ` Jun Hao
2016-02-29  2:22     ` Lars Ingebrigtsen
     [not found]       ` <m2si09f19c.fsf@aol.com>
2016-03-02 16:58         ` Lars Ingebrigtsen
     [not found]           ` <m2k2ljfyuj.fsf@aol.com>
2016-03-03 16:54             ` Lars Ingebrigtsen
2016-03-03 16:59               ` Glenn Morris
     [not found]                 ` <m2mvqegwtu.fsf@aol.com>
     [not found]                   ` <m2bn5d7fjw.fsf@aol.com>
2016-04-24 12:37                     ` Lars Magne Ingebrigtsen
2016-04-24 12:43                       ` Lars Magne Ingebrigtsen
2016-04-25 14:41                         ` Jun Hao

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).