GNU bug report logs - #38284
27.0.50; [PATCH] Make auth-source-pass-search understand port lists

Previous Next

Package: emacs;

Reported by: João Távora <joaotavora <at> gmail.com>

Date: Wed, 20 Nov 2019 00:22:05 UTC

Severity: normal

Tags: patch

Found in version 27.0.50

Fixed in version 27.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: João Távora <joaotavora <at> gmail.com>
Subject: bug#38284: closed (Re: bug#38284: 27.0.50; [PATCH] Make
 auth-source-pass-search understand port lists)
Date: Wed, 22 Jan 2020 08:03:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#38284: 27.0.50; [PATCH] Make auth-source-pass-search understand port lists

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 38284 <at> debbugs.gnu.org.

-- 
38284: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38284
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Kangas <stefan <at> marxist.se>
To: Damien Cassou <damien <at> cassou.me>
Cc: 38284-done <at> debbugs.gnu.org, Nicolas Petton <nicolas <at> petton.fr>,
 João Távora <joaotavora <at> gmail.com>
Subject: Re: bug#38284: 27.0.50; [PATCH] Make auth-source-pass-search
 understand port lists
Date: Wed, 22 Jan 2020 09:02:45 +0100
Damien Cassou <damien <at> cassou.me> writes:

>> Damien, could you please re-send the patch formatted by "git
>> format-patch -1"?  Please also include a commit message with a
>> ChangeLog entry as described in the CONTRIBUTE file.
>
> The patch was only meant to be added to João's own patch.

Understood.

> Here is a standalone one.

Thanks, it seems to be working fine (the test passes), so I have now
pushed this to master as commit abb2515b0c.

I don't see anything more to do here, so I'm also closing this bug.

Best regards,
Stefan Kangas

[Message part 3 (message/rfc822, inline)]
From: João Távora <joaotavora <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; [PATCH] Make auth-source-pass-search understand port lists
Date: Wed, 20 Nov 2019 00:20:28 +0000
[Message part 4 (text/plain, inline)]
Hi,

When trying to follow along a tutorial on setting up Gnus for GMAIL, I
tried to use auth-source-pass.el to access encrypted entries under
~/.password-store instead of the usual ~/.authinfo.gpg.

After much wrestling with the system, I couldn't figure out why my
entry:

   gmail:imap.gpg

whose contents are

   NotReallyThePassword
   host: imap.gmail.com
   user: joaotavora <at> gmail.com
   port: 993

weren't being understood by the new auth-source.  Eventually I came to
this patch, which seems to do the right thing.

[0001-Make-auth-source-pass-search-understand-port-lists.patch (text/x-diff, inline)]
From 4a6c24c23c9f7097807c1ef58688b51db330f503 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= <joaotavora <at> gmail.com>
Date: Wed, 20 Nov 2019 00:11:00 +0000
Subject: [PATCH] Make auth-source-pass-search understand port lists

For cases such as a typical IMAP Gnus setup, auto-source-pass-search
will be passed a list of "port aliases" like (993 "imaps" "imap" "993"
"143") in hopes of finding a matching ~/.password-store entry.

This modification makes this library understand and unroll the port
list so that, i.e. "domain:993", "domain:imaps"", "domain:imap",
etc. are computed as potential suffixes.  Previously a nonsensical
string "domain:(993 imaps imap ...)" was return.

* lisp/auth-source-pass.el
(auth-source-pass--generate-entry-suffixes): Allow PORT to
be a list of ports.
---
 lisp/auth-source-pass.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 524a72792c..cc0a6fe4de 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -269,10 +269,15 @@ auth-source-pass--generate-entry-suffixes
 
 Based on the supported pathname patterns for HOSTNAME, USER, &
 PORT, return a list of possible suffixes for matching entries in
-the password-store."
+the password-store.
+
+PORT may be a list of ports."
   (let ((domains (auth-source-pass--domains (split-string hostname "\\."))))
-    (seq-mapcat (lambda (n)
-                  (auth-source-pass--name-port-user-suffixes n user port))
+    (seq-mapcat (lambda (d)
+                  (seq-mapcat
+                   (lambda (p)
+                     (auth-source-pass--name-port-user-suffixes d user p))
+                   (if (listp port) port (list port))))
                 domains)))
 
 (defun auth-source-pass--domains (name-components)
-- 
2.24.0

[Message part 6 (text/plain, inline)]
Please have a look,
João



This bug report was last modified 5 years and 117 days ago.

Previous Next


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