unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory
@ 2017-12-11 20:09 John Wiegley
       [not found] ` <handler.29663.B.151302297517890.ack@debbugs.gnu.org>
  2019-10-06  2:07 ` bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory Stefan Kangas
  0 siblings, 2 replies; 5+ messages in thread
From: John Wiegley @ 2017-12-11 20:09 UTC (permalink / raw)
  To: 29663

`auth-source-pass-entries' is defined as follows:

  (defun auth-source-pass-entries ()
    "Return a list of all password store entries."
    (let ((store-dir (expand-file-name "~/.password-store/")))
      (mapcar
       (lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
       (directory-files-recursively store-dir "\.gpg$"))))

However, the pass utility does not require that this be the directory where
passwords are stored. This should be a customizable variable, initialized from
the value of (getenv "PASSWORD_STORE_DIR") if set.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2





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

* bug#29663: Acknowledgement (26.0.90; autho-source-pass-entries hardcodes .password-store directory)
       [not found] ` <handler.29663.B.151302297517890.ack@debbugs.gnu.org>
@ 2017-12-11 20:21   ` John Wiegley
  0 siblings, 0 replies; 5+ messages in thread
From: John Wiegley @ 2017-12-11 20:21 UTC (permalink / raw)
  To: 29663

Note that the same problem occurs here too:

  (defun auth-source-pass--read-entry (entry)
    "Return a string with the file content of ENTRY."
    (with-temp-buffer
      (insert-file-contents (expand-file-name
                             (format "%s.gpg" entry)
                             "~/.password-store"))
      (buffer-substring-no-properties (point-min) (point-max))))

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2





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

* bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory
  2017-12-11 20:09 bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory John Wiegley
       [not found] ` <handler.29663.B.151302297517890.ack@debbugs.gnu.org>
@ 2019-10-06  2:07 ` Stefan Kangas
  2019-10-07  2:44   ` Basil L. Contovounesios
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2019-10-06  2:07 UTC (permalink / raw)
  To: John Wiegley; +Cc: 29663

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

"John Wiegley" <johnw@gnu.org> writes:

> `auth-source-pass-entries' is defined as follows:
>
>   (defun auth-source-pass-entries ()
>     "Return a list of all password store entries."
>     (let ((store-dir (expand-file-name "~/.password-store/")))
>       (mapcar
>        (lambda (file) (file-name-sans-extension (file-relative-name file store-dir)))
>        (directory-files-recursively store-dir "\.gpg$"))))
>
> However, the pass utility does not require that this be the directory where
> passwords are stored. This should be a customizable variable, initialized from
> the value of (getenv "PASSWORD_STORE_DIR") if set.

Hi John,

I see that an option was added recently which takes care of the first
part of your requesti:

a63cbb56df 2019-01-13 Add auth-source-pass-filename option

I've attached a patch which initializes auth-source-pass-filename to
(getenv "PASSWORD_STORE_DIR") when it's set.  What do you think?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Use-PASSWORD_STORE_DIR-in-auth-source-pass-when-set.patch --]
[-- Type: text/x-patch, Size: 936 bytes --]

From 2bb16aaa577fe45f7ed18cb84413c53a4c0daea2 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Sun, 6 Oct 2019 04:02:27 +0200
Subject: [PATCH] Use PASSWORD_STORE_DIR in auth-source-pass when set

* lisp/auth-source-pass.el (auth-source-pass-filename): Initialize to
PASSWORD_STORE_DIR environment variable when set.  (Bug#29663)
---
 lisp/auth-source-pass.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index c45c782c27..524a72792c 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -45,7 +45,8 @@ auth-source-pass
   :group 'auth-source
   :version "27.1")
 
-(defcustom auth-source-pass-filename "~/.password-store"
+(defcustom auth-source-pass-filename
+  (or (getenv "PASSWORD_STORE_DIR") "~/.password-store")
   "Filename of the password-store folder."
   :type 'directory
   :version "27.1")
-- 
2.20.1


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

* bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory
  2019-10-06  2:07 ` bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory Stefan Kangas
@ 2019-10-07  2:44   ` Basil L. Contovounesios
  2019-11-02  0:34     ` Stefan Kangas
  0 siblings, 1 reply; 5+ messages in thread
From: Basil L. Contovounesios @ 2019-10-07  2:44 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 29663, John Wiegley

Stefan Kangas <stefan@marxist.se> writes:

> I've attached a patch which initializes auth-source-pass-filename to
> (getenv "PASSWORD_STORE_DIR") when it's set.  What do you think?

LGTM, FWIW.

Thanks,

-- 
Basil





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

* bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory
  2019-10-07  2:44   ` Basil L. Contovounesios
@ 2019-11-02  0:34     ` Stefan Kangas
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2019-11-02  0:34 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 29663, John Wiegley

close 29663 27.1
thanks

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> I've attached a patch which initializes auth-source-pass-filename to
>> (getenv "PASSWORD_STORE_DIR") when it's set.  What do you think?
>
> LGTM, FWIW.

No other comments within 3 weeks, so I've now pushed this as commit
6b2745fe2e.  I'm consequently closing this bug.

Best regards,
Stefan Kangas





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

end of thread, other threads:[~2019-11-02  0:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-11 20:09 bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory John Wiegley
     [not found] ` <handler.29663.B.151302297517890.ack@debbugs.gnu.org>
2017-12-11 20:21   ` bug#29663: Acknowledgement (26.0.90; autho-source-pass-entries hardcodes .password-store directory) John Wiegley
2019-10-06  2:07 ` bug#29663: 26.0.90; autho-source-pass-entries hardcodes .password-store directory Stefan Kangas
2019-10-07  2:44   ` Basil L. Contovounesios
2019-11-02  0:34     ` Stefan Kangas

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