[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#36834: 27.0.50; [PATCH] password-cache.el: confuses key absence with
From: |
Eli Zaretskii |
Subject: |
bug#36834: 27.0.50; [PATCH] password-cache.el: confuses key absence with nil password |
Date: |
Sat, 10 Aug 2019 13:01:18 +0300 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Sat, 10 Aug 2019 05:14:22 -0400
> Cc: 36834@debbugs.gnu.org
>
> > So I propose this patch:
> >
> > diff --git a/lisp/password-cache.el b/lisp/password-cache.el
> > index 5a09ae4859..6009fb491e 100644
> > --- a/lisp/password-cache.el
> > +++ b/lisp/password-cache.el
> > @@ -81,7 +81,8 @@ password-in-cache-p
> > "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 @@ password-cache-remove
> > (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))
>
> Looks good to me, thanks.
Thanks.
Óscar, please push to the emacs-26 branch, and thanks.