]> git.eshelyaron.com Git - emacs.git/commitdiff
Adapt Tramp for `auth-info-password'
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 8 Jan 2022 12:38:18 +0000 (13:38 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 8 Jan 2022 12:38:18 +0000 (13:38 +0100)
* lisp/net/tramp-compat.el (tramp-compat-auth-info-password):
New defalias.

* lisp/net/tramp.el (tramp-read-passwd): Use it.

lisp/net/tramp-compat.el
lisp/net/tramp.el

index 0a45b12a04afa153f4143995915d6170beaa7534..db7e7d67c4d491f0984b92de54f77cdc0185323a 100644 (file)
@@ -283,6 +283,16 @@ CONDITION can also be a list of error conditions."
       (tramp-error vec tramp-permission-denied file)
     (tramp-error vec tramp-permission-denied "Permission denied: %s" file)))
 
+;; Function `auth-info-password' is new in Emacs 29.1.
+(defalias 'tramp-compat-auth-info-password
+  (if (fboundp 'auth-info-password)
+      #'auth-info-password
+    (lambda (auth-info)
+      (let ((secret (plist-get auth-info :secret)))
+       (while (functionp secret)
+          (setq secret (funcall secret)))
+       secret))))
+
 (dolist (elt (all-completions "tramp-compat-" obarray 'functionp))
   (put (intern elt) 'tramp-suppress-trace t))
 
index fdbb78123dfbb05ac96c677188fb48e822214b54..7d6157ed8c28b37a7b0fa2a128ac9f7fdd905ca1 100644 (file)
@@ -5756,7 +5756,8 @@ Invokes `password-read' if available, `read-passwd' else."
                              :create t))
                            tramp-password-save-function
                            (plist-get auth-info :save-function)
-                           auth-passwd (auth-info-password auth-info))))
+                           auth-passwd
+                           (tramp-compat-auth-info-password auth-info))))
 
               ;; Try the password cache.
               (progn