]> git.eshelyaron.com Git - emacs.git/commit
Fix discrepancies in auth-source-pass vs netrc behavior
authorF. Jason Park <jp@neverwas.me>
Mon, 12 Aug 2024 04:55:32 +0000 (21:55 -0700)
committerEshel Yaron <me@eshelyaron.com>
Sun, 8 Sep 2024 11:23:59 +0000 (13:23 +0200)
commitc6cac20f1a4a124dcaf125c02026d8987505493c
tree99622f295976ed452abc9ebbb79cc2382f87cdc6
parentbaea55bffb44722bda16b35b4552e79cf6028a15
Fix discrepancies in auth-source-pass vs netrc behavior

The option `auth-source-pass-extra-query-keywords' aims to make its
back end hew as close to the other built-in ones as possible, except
WRT features not yet implemented, such as arbitrary "attribute"
retrieval and new entry creation.  This change only concerns behavior
exhibited when the option is enabled.

* lisp/auth-source-pass.el (auth-source-pass--match-parts): Account
for the case in which a query lacks a reference parameter for a
`:port' or `:user' but still requires one or both via the `:require'
keyword.  Previously, such a query would fail even when an entry met
this requirement by simply specifying a field with any non-null value
corresponding to the required parameter.
(auth-source-pass--find-match-many): Account for the baseline case
where a matching entry lacks a secret and the user doesn't require
one.  Although this function doesn't currently return so-called
"attributes" from the contents of a matching decrypted file, were it
to eventually, this case would no longer be academic.
* test/lisp/auth-source-pass-tests.el
(auth-source-pass-extra-query-keywords--req-noparam-miss-netrc)
(auth-source-pass-extra-query-keywords--req-noparam-miss)
(auth-source-pass-extra-query-keywords--req-param-netrc)
(auth-source-pass-extra-query-keywords--req-param): New tests.
(auth-source-pass-extra-query-keywords--netrc-baseline): New test
asserting behavior of netrc backend when passed a lone `:host' as a
query parameter.
(auth-source-pass-extra-query-keywords--baseline): Reverse expected
outcome to match that of the netrc reference implementation.
(bug#72441)

(cherry picked from commit 80228d1f6eded7a042dfd29c3614b3214934b5c3)
lisp/auth-source-pass.el
test/lisp/auth-source-pass-tests.el