emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f01365f: password-cache: differentiate null values


From: Oscar Fuentes
Subject: [Emacs-diffs] master f01365f: password-cache: differentiate null values from non-existent entries
Date: Sun, 11 Aug 2019 19:44:20 -0400 (EDT)

branch: master
commit f01365f62c921407acead13bb350816a313a8c42
Author: Óscar Fuentes <address@hidden>
Commit: Óscar Fuentes <address@hidden>

    password-cache: differentiate null values from non-existent entries
    
    * password-cache.el (password-in-cache-p, password-cache-add):
      properly detect non-existent entry.  (Bug#36834)
---
 lisp/password-cache.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 5a09ae4..6009fb4 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -81,7 +81,8 @@ regulate cache behavior."
   "Check if KEY is in the cache."
   (and password-cache
        key
-       (gethash key password-data)))
+       (not (eq (gethash key password-data 'password-cache-no-data)
+                'password-cache-no-data))))
 
 (defun password-read (prompt &optional key)
   "Read password, for use with KEY, from user, or from cache if wanted.
@@ -125,7 +126,9 @@ user again."
 (defun password-cache-add (key password)
   "Add password to cache.
 The password is removed by a timer after `password-cache-expiry' seconds."
-  (when (and password-cache-expiry (null (gethash key password-data)))
+  (when (and password-cache-expiry
+             (eq (gethash key password-data 'password-cache-no-data)
+                 'password-cache-no-data))
     (run-at-time password-cache-expiry nil
                 #'password-cache-remove
                 key))



reply via email to

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