aboutsummaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-04-30 19:15:18 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-04-30 19:15:33 -0700
commitfd692e78a0a17487bb81dbd6ee78b6881f16b5e2 (patch)
treeeb49e80b000d33e8d5313ff536d820d53f28aaa8 /src/data
parent4e356a11bfe43202e17532506258603220151b28 (diff)
downloadconsfigurator-fd692e78a0a17487bb81dbd6ee78b6881f16b5e2.tar.gz
DATA.SSH-ASKPASS: fix return value of first closure
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data')
-rw-r--r--src/data/ssh-askpass.lisp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/data/ssh-askpass.lisp b/src/data/ssh-askpass.lisp
index 6d644d9..e6ff0d7 100644
--- a/src/data/ssh-askpass.lisp
+++ b/src/data/ssh-askpass.lisp
@@ -26,10 +26,17 @@ using ssh-askpass(1) to prompt the user to input it. Useful for things like
sudo passwords."
(unless (uiop:getenv "DISPLAY")
(missing-data-source "DISPLAY not set; cannot launch ssh-askpass(1)."))
+ ;; This cache duplicates CONSFIGURATOR::*STRING-DATA*, but if we don't keep
+ ;; our own cache here, then we would always have to return the current time
+ ;; from the first closure, and then we'd prompt the user for input every
+ ;; time, bypassing CONSFIGURATOR::*STRING-DATA*.
(let ((cache (make-hash-table :test #'equal)))
(cons
(lambda (iden1 iden2)
- (and (re:scan iden1-re iden1) (re:scan iden2-re iden2)))
+ (and (re:scan iden1-re iden1)
+ (re:scan iden2-re iden2)
+ (if-let ((cached (gethash (cons iden1 iden2) cache)))
+ (data-version cached) (get-universal-time))))
(lambda (iden1 iden2)
(let ((pair (cons iden1 iden2)))
(or (gethash pair cache)