diff lisp/net/tramp-sh.el @ 111964:ec45dfa69a06

* net/tramp.el (tramp-temp-buffer-file-name): Make it permanent-local. (tramp-handle-insert-file-contents): Do not set permanent-local property. * net/tramp-cache.el (tramp-persistency-file-name): Use `locate-user-emacs-file' if fboundp. * net/tramp-sh.el (tramp-methods): Add "ksu". (tramp-default-user-alist): Add "ksu". Use `regexp-opt' for method list.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 14 Dec 2010 21:33:33 +0100
parents c00190a8c8ef
children 9780afa403a4
line wrap: on
line diff
--- a/lisp/net/tramp-sh.el	Tue Dec 14 12:52:30 2010 +0000
+++ b/lisp/net/tramp-sh.el	Tue Dec 14 21:33:33 2010 +0100
@@ -306,6 +306,12 @@
     (tramp-remote-sh            "/bin/sh")))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
+  '("ksu"
+    (tramp-login-program        "ksu")
+    (tramp-login-args           (("%u") ("-q")))
+    (tramp-remote-sh            "/bin/sh")))
+;;;###tramp-autoload
+(add-to-list 'tramp-methods
   '("krlogin"
     (tramp-login-program        "krlogin")
     (tramp-login-args           (("%h") ("-l" "%u") ("-x")))
@@ -378,9 +384,16 @@
 	     `(,tramp-local-host-regexp "\\`root\\'" "su"))
 
 (add-to-list 'tramp-default-user-alist
-	     '("\\`su\\(do\\)?\\'" nil "root"))
+	     `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
+	       nil "root"))
 (add-to-list 'tramp-default-user-alist
-	     `("\\`r\\(em\\)?\\(cp\\|sh\\)\\|telnet\\|plink1?\\'"
+	     `(,(concat
+		 "\\`"
+		 (regexp-opt
+		  '("rcp" "remcp" "scp" "scp1" "scp2" "scpc" "scpx" "sftp"
+		    "rsync" "rsyncc" "rsh" "remsh" "ssh" "ssh1" "ssh2" "sshx"
+		    "telnet" "krlogin" "plink" "plink1" "pscp" "psftp" "fcp"))
+		 "\\'")
 	       nil ,(user-login-name)))
 
 (defconst tramp-completion-function-alist-rsh
@@ -437,6 +450,7 @@
 (tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet)
 (tramp-set-completion-function "su" tramp-completion-function-alist-su)
 (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
+(tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
 (tramp-set-completion-function "krlogin" tramp-completion-function-alist-rsh)
 (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
 (tramp-set-completion-function "plink1" tramp-completion-function-alist-ssh)
@@ -2672,20 +2686,20 @@
 		  (narrow-to-region (point-max) (point-max))
 		  (if command
 		      ;; Send the command.
-                      (tramp-send-command v command nil t) ; nooutput
-                    ;; Check, whether a pty is associated.
-                    (tramp-maybe-open-connection v)
-                    (unless (tramp-compat-process-get
-                             (tramp-get-connection-process v) 'remote-tty)
-                      (tramp-error
+		      (tramp-send-command v command nil t) ; nooutput
+		    ;; Check, whether a pty is associated.
+		    (tramp-maybe-open-connection v)
+		    (unless (tramp-compat-process-get
+			     (tramp-get-connection-process v) 'remote-tty)
+		      (tramp-error
 		       v 'file-error
 		       "pty association is not supported for `%s'" name)))))
-              (let ((p (tramp-get-connection-process v)))
-                ;; Set sentinel and query flag for this process.
-                (tramp-set-connection-property p "vector" v)
-                (set-process-sentinel p 'tramp-process-sentinel)
-                (tramp-compat-set-process-query-on-exit-flag p t)
-                ;; Return process.
+	      (let ((p (tramp-get-connection-process v)))
+		;; Set sentinel and query flag for this process.
+		(tramp-set-connection-property p "vector" v)
+		(set-process-sentinel p 'tramp-process-sentinel)
+		(tramp-compat-set-process-query-on-exit-flag p t)
+		;; Return process.
 		p)))
 	;; Save exit.
 	(with-current-buffer (tramp-get-connection-buffer v)