]> git.eshelyaron.com Git - emacs.git/commitdiff
password-cache: differentiate null values from non-existent entries
authorÓscar Fuentes <ofv@wanadoo.es>
Sun, 11 Aug 2019 23:42:16 +0000 (01:42 +0200)
committerÓscar Fuentes <ofv@wanadoo.es>
Sun, 11 Aug 2019 23:43:19 +0000 (01:43 +0200)
* password-cache.el (password-in-cache-p, password-cache-add):
  properly detect non-existent entry.  (Bug#36834)

lisp/password-cache.el

index 5a09ae4859d73abd1a5dd4e16ff5e5dbe796225c..6009fb491e801f70cbc7571d4b5a2c8623daa494 100644 (file)
@@ -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))