emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 527efaf 01/13: Fix auth-source-pass to return nil i


From: Damien Cassou
Subject: [Emacs-diffs] master 527efaf 01/13: Fix auth-source-pass to return nil if no entry found
Date: Mon, 24 Jun 2019 03:22:45 -0400 (EDT)

branch: master
commit 527efaf798ad73878f6df03f5af9d9b0ba517b9d
Author: Magnus Henoch <address@hidden>
Commit: Damien Cassou <address@hidden>

    Fix auth-source-pass to return nil if no entry found
    
    * lisp/auth-source-pass.el (auth-source-pass-search): If there is no
    matching entry, auth-source-pass-search should return nil, not (nil).
    This lets auth-source fall back to other backends in the auth-sources
    list.
    * test/lisp/auth-source-pass-tests.el: Add corresponding test.
    
    Copyright-paperwork-exempt: yes
---
 lisp/auth-source-pass.el            | 3 ++-
 test/lisp/auth-source-pass-tests.el | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 4283ed0..c82c901 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -56,7 +56,8 @@ See `auth-source-search' for details on SPEC."
          ;; Do not build a result, as none will match when HOST is nil
          nil)
         (t
-         (list (auth-source-pass--build-result host port user)))))
+         (when-let ((result (auth-source-pass--build-result host port user)))
+           (list result)))))
 
 (defun auth-source-pass--build-result (host port user)
   "Build auth-source-pass entry matching HOST, PORT and USER."
diff --git a/test/lisp/auth-source-pass-tests.el 
b/test/lisp/auth-source-pass-tests.el
index d1e486a..ab9ef92 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -83,6 +83,11 @@ This function is intended to be set to `auth-source-debug`."
                                   ("bar"))
     (should-not (auth-source-pass-search :host nil))))
 
+(ert-deftest auth-source-pass-not-found ()
+  (auth-source-pass--with-store '(("foo" ("port" . "foo-port") ("host" . 
"foo-user"))
+                                  ("bar"))
+    (should-not (auth-source-pass-search :host "baz"))))
+
 
 (ert-deftest auth-source-pass-find-match-matching-at-entry-name ()
   (auth-source-pass--with-store '(("foo"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]