emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v


From: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,v
Date: Thu, 15 May 2008 21:06:03 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       08/05/15 21:06:02

Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -b -r1.196 -r1.197
--- tramp.el    14 May 2008 19:54:12 -0000      1.196
+++ tramp.el    15 May 2008 21:06:00 -0000      1.197
@@ -87,6 +87,10 @@
 (require 'shell)
 (require 'advice)
 
+(if (featurep 'xemacs)
+    (load "auth-source" 'noerror)
+  (require 'auth-source nil 'noerror))
+
 ;; Requiring 'tramp-cache results in an endless loop.
 (autoload 'tramp-get-file-property "tramp-cache")
 (autoload 'tramp-set-file-property "tramp-cache")
@@ -4425,7 +4429,7 @@
                  'dired-file-modtime 'dired-make-compressed-filename
                  'dired-recursive-delete-directory 'dired-set-file-modtime
                  'dired-shell-unhandle-file-name 'dired-uucode-file
-                 'insert-file-contents-literally 'recover-file
+                 'insert-file-contents-literally 'make-temp-name 'recover-file
                  'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail))
     (if (file-name-absolute-p (nth 0 args))
        (nth 0 args)
@@ -7200,6 +7204,7 @@
 
 (defun tramp-read-passwd (proc &optional prompt)
   "Read a password from user (compat function).
+Consults the auth-source package.
 Invokes `password-read' if available, `read-passwd' else."
   (let* ((key (tramp-make-tramp-file-name
               tramp-current-method tramp-current-user
@@ -7209,12 +7214,24 @@
              (with-current-buffer (process-buffer proc)
                (tramp-check-for-regexp proc tramp-password-prompt-regexp)
                (format "%s for %s " (capitalize (match-string 1)) key)))))
+
+    (or
+     ;; see if auth-sources contains something useful, if it's bound
+     (when (boundp 'auth-sources)
+       (or
+       ;; 1. try with Tramp's current method
+       (auth-source-user-or-password
+        "password" tramp-current-host tramp-current-method)
+       ;; 2. hard-code the method to be "tramp"
+       (auth-source-user-or-password
+        "password" tramp-current-host "tramp")))
+     ;; 3. else, get the password interactively
     (if (functionp 'password-read)
        (let ((password (funcall (symbol-function 'password-read)
                                 pw-prompt key)))
          (funcall (symbol-function 'password-cache-add) key password)
          password)
-      (read-passwd pw-prompt))))
+       (read-passwd pw-prompt)))))
 
 (defun tramp-clear-passwd (vec)
   "Clear password cache for connection related to VEC."




reply via email to

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