unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20541: ERC password fetching using Secret Service API is broken
@ 2015-05-10 14:13 Krzysztof Jurewicz
  2015-06-01  9:20 ` Michael Albinus
  2015-12-27  8:05 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Jurewicz @ 2015-05-10 14:13 UTC (permalink / raw)
  To: 20541

When trying to store ERC passwords using Secret Service API (i.e. when
using GNOME Keyring), ERC breaks when trying to join a channel.

Steps to reproduce:

⒈ Run emacs -Q.
⒉ Eval (require 'auth-source).
⒊ Eval (setq auth-sources '("secrets:FOO")), where FOO is an existing
keyring name.
⒋ Open ERC.
⒌ Try to connect to Freenode using the default settings.

What happens:
The following error is displayed:
auth-source-secrets-listify-pattern: Wrong type argument: sequencep, 6667

What should happen:
I should connect to Freenode.

One possible patch is attached below. This is the simplest solution; I
have not thought much about whether it may be more desirable to convert
numbers to strings inside the secrets.el package.

From 25f798b3b86a34bd6b262c59c3733d72eec50c13 Mon Sep 17 00:00:00 2001
From: Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com>
Date: Thu, 7 May 2015 13:01:24 +0200
Subject: [PATCH] * lisp/erc/erc.el (erc-open): Fix password fetching

ERC used to pass the port number as a number, however when using
Secret Service API, only strings can be used.

Copyright-paperwork-exempt: yes
---
 lisp/erc/erc.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index cf422f1..a8f1478 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -2010,7 +2010,8 @@ Returns the buffer for the given server or channel."
                            (auth-source-search :host server
                                                :max 1
                                                :user nick
-                                               :port port
+                                               ;; secrets.el wouldn’t accept a number
+                                               :port (if (numberp port) (number-to-string port) port)
                                                :require '(:secret)))
                       :secret)))
                 (if (functionp secret)
--
2.4.0





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

* bug#20541: ERC password fetching using Secret Service API is broken
  2015-05-10 14:13 bug#20541: ERC password fetching using Secret Service API is broken Krzysztof Jurewicz
@ 2015-06-01  9:20 ` Michael Albinus
  2015-06-30  2:28   ` Ted Zlatanov
  2015-12-27  8:05 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2015-06-01  9:20 UTC (permalink / raw)
  To: Krzysztof Jurewicz; +Cc: Ted Zlatanov, 20541

Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com> writes:

> One possible patch is attached below. This is the simplest solution; I
> have not thought much about whether it may be more desirable to convert
> numbers to strings inside the secrets.el package.

Well, secrets.el expects only strings as attributes. No conversion
foreseen. I don't know what auth-source.el does. If auth-source-search
also allows only strings (and symbol names) as attributes, then your
patch is right. Otherwise, if a :port attribute could also be an
integer, it shall be transformed to a string.

Ted?

> From 25f798b3b86a34bd6b262c59c3733d72eec50c13 Mon Sep 17 00:00:00 2001
> From: Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com>
> Date: Thu, 7 May 2015 13:01:24 +0200
> Subject: [PATCH] * lisp/erc/erc.el (erc-open): Fix password fetching
>
> ERC used to pass the port number as a number, however when using
> Secret Service API, only strings can be used.
>
> Copyright-paperwork-exempt: yes
> ---
>  lisp/erc/erc.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
> index cf422f1..a8f1478 100644
> --- a/lisp/erc/erc.el
> +++ b/lisp/erc/erc.el
> @@ -2010,7 +2010,8 @@ Returns the buffer for the given server or channel."
>                             (auth-source-search :host server
>                                                 :max 1
>                                                 :user nick
> -                                               :port port
> +                                               ;; secrets.el wouldn’t accept a number
> +                                               :port (if (numberp port) (number-to-string port) port)
>                                                 :require '(:secret)))
>                        :secret)))
>                  (if (functionp secret)
> --
> 2.4.0

Best regards, Michael.





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

* bug#20541: ERC password fetching using Secret Service API is broken
  2015-06-01  9:20 ` Michael Albinus
@ 2015-06-30  2:28   ` Ted Zlatanov
  0 siblings, 0 replies; 4+ messages in thread
From: Ted Zlatanov @ 2015-06-30  2:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Krzysztof Jurewicz, 20541

On Mon, 01 Jun 2015 11:20:58 +0200 Michael Albinus <michael.albinus@gmx.de> wrote: 

MA> Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com> writes:
>> One possible patch is attached below. This is the simplest solution; I
>> have not thought much about whether it may be more desirable to convert
>> numbers to strings inside the secrets.el package.

MA> Well, secrets.el expects only strings as attributes. No conversion
MA> foreseen. I don't know what auth-source.el does. If auth-source-search
MA> also allows only strings (and symbol names) as attributes, then your
MA> patch is right. Otherwise, if a :port attribute could also be an
MA> integer, it shall be transformed to a string.

Sorry for the late reply.

The docs of `auth-source-search' say:

    A string value is always matched literally.  A symbol is matched
    as its string value, literally.  All the SPEC values can be
    single values (symbol or string) or lists thereof (in which case
    any of the search terms matches).

...so numbers are not allowed. By design, that means that "80" and
"http" can be used for :port, for instance. IIRC there was no gain from
making any of the search criteria take numbers in the case of
auth-source.el specifically.

So I think the patch is OK :)

Ted





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

* bug#20541: ERC password fetching using Secret Service API is broken
  2015-05-10 14:13 bug#20541: ERC password fetching using Secret Service API is broken Krzysztof Jurewicz
  2015-06-01  9:20 ` Michael Albinus
@ 2015-12-27  8:05 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2015-12-27  8:05 UTC (permalink / raw)
  To: Krzysztof Jurewicz; +Cc: 20541

Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com> writes:

>  lisp/erc/erc.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
> index cf422f1..a8f1478 100644
> --- a/lisp/erc/erc.el
> +++ b/lisp/erc/erc.el
> @@ -2010,7 +2010,8 @@ Returns the buffer for the given server or channel."
>                             (auth-source-search :host server
>                                                 :max 1
>                                                 :user nick
> -                                               :port port
> +                                               ;; secrets.el wouldn.t accept a number
> +                                               :port (if (numberp port) (number-to-string port) port)
>                                                 :require '(:secret)))
>                        :secret)))

Thanks; applied to Emacs 25.1.

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





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

end of thread, other threads:[~2015-12-27  8:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-10 14:13 bug#20541: ERC password fetching using Secret Service API is broken Krzysztof Jurewicz
2015-06-01  9:20 ` Michael Albinus
2015-06-30  2:28   ` Ted Zlatanov
2015-12-27  8:05 ` Lars Ingebrigtsen

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