GNU bug report logs - #76168
30.0.91; auth-source backend password-store has no way to pass :force to nntp-send-authinfo

Previous Next

Packages: gnus, emacs;

Reported by: Mekeor Melire <mekeor <at> posteo.de>

Date: Sun, 9 Feb 2025 23:59:01 UTC

Severity: normal

Found in version 30.0.91

To reply to this bug, email your comments to 76168 AT debbugs.gnu.org.

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

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


Report forwarded to larsi <at> gnus.org, damien <at> cassou.me, nicolas <at> petton.fr, camalot <at> picnicpark.org, bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#76168; Package emacs,gnus. (Sun, 09 Feb 2025 23:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mekeor Melire <mekeor <at> posteo.de>:
New bug report received and forwarded. Copy sent to larsi <at> gnus.org, damien <at> cassou.me, nicolas <at> petton.fr, camalot <at> picnicpark.org, bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org. (Sun, 09 Feb 2025 23:59:02 GMT) Full text and rfc822 format available.

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

From: Mekeor Melire <mekeor <at> posteo.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.91; auth-source backend password-store has no way to pass
 :force to nntp-send-authinfo
Date: Sun, 09 Feb 2025 23:57:50 +0000
[Message part 1 (text/plain, inline)]
BACKGROUND

The Gnus backend nntp features entries in ~/.authinfo with a field names
`force'.  In fact, the nntp server I use, has the following setup
instructions for Gnus:

[Message part 2 (text/plain, inline)]
add the following line to .authinfo:
machine ... login ... force yes password ...
[Message part 3 (text/plain, inline)]

BUG DESCRIPTION

Unfortunately, it is currently not possible to set this kind of `force'
flag with `password-store' as auth-source backend, as implemented in
lisp/auth-source-pass.el.


WORKAROUND

As a workaround, users can just set `nntp-authinfo-force' to non-nil.
But this will then of course affect all nntp servers, not just a
specific one.


BUG EXPLANATION

The bug emerges as follows:

- `nntp-send-authinfo' (lisp/gnus/nntp.el) calls `auth-source-search'
  and accesses the `:force' property of its car.

- `auth-source-pass--build-result' (lisp/auth-source-pass.el) handles
  "host", "port", "user", and "secret" line-labels in password-store
  entries explicitly but no "force".


POSSIBLE FIX

One approach to fix this bug would be to teach
`auth-source-pass--build-result' about `force':

[Message part 4 (text/x-patch, inline)]
 (defun auth-source-pass--build-result (hosts port user)
   "Build auth-source-pass entry matching HOSTS, PORT and USER.

 HOSTS can be a string or a list of strings."
   (let ((entry-data (auth-source-pass--find-match hosts user port)))
     (when entry-data
       (let ((retval (list
+                     :force (auth-source-pass--get-attr "force" entry-data)
                      :host (auth-source-pass--get-attr "host" entry-data)
                      :port (or (auth-source-pass--get-attr "port" entry-data) port)
                      :user (or (auth-source-pass--get-attr "user" entry-data) user)
                      :secret (lambda () (auth-source-pass--get-attr 'secret entry-data)))))
         (auth-source-pass--do-debug "return %s as final result (plus hidden password)"
                                     (seq-subseq retval 0 -2)) ;; remove password
         retval))))
[Message part 5 (text/plain, inline)]
Then users could have password-store entries like:

[Message part 6 (text/plain, inline)]
my-secret-password

force: yes
user: my-user-name

This bug report was last modified 11 days ago.

Previous Next


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