emacs-diffs
[Top][All Lists]
Advanced

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

master 9652736b08: Adapt Tramp for `auth-info-password'


From: Michael Albinus
Subject: master 9652736b08: Adapt Tramp for `auth-info-password'
Date: Sat, 8 Jan 2022 07:38:28 -0500 (EST)

branch: master
commit 9652736b084a09133e983e204eaa29573c0359cc
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Adapt Tramp for `auth-info-password'
    
    * 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 | 10 ++++++++++
 lisp/net/tramp.el        |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 0a45b12a04..db7e7d67c4 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -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))
 
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fdbb78123d..7d6157ed8c 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -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



reply via email to

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