emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp/net tramp.el


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Wed, 08 Jul 2009 12:40:59 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/07/08 12:40:59

Modified files:
        lisp/net       : tramp.el 

Log message:
        * net/tramp.el (tramp-set-file-uid-gid): Handle the case the
        remote user is root, on the local host.
        (tramp-local-host-p): Either the local user or the remote user
        must be root.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.242&r2=1.243

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -b -r1.242 -r1.243
--- tramp.el    6 Jul 2009 13:34:51 -0000       1.242
+++ tramp.el    8 Jul 2009 12:40:58 -0000       1.243
@@ -2709,6 +2709,9 @@
   ;; the majority of cases.
   (if (file-remote-p filename)
       (with-parsed-tramp-file-name filename nil
+       (if (and (zerop (user-uid)) (tramp-local-host-p v))
+           ;; If we are root on the local host, we can do it directly.
+           (tramp-set-file-uid-gid localname uid gid)
        (let ((uid (or (and (integerp uid) uid)
                       (tramp-get-remote-uid v 'integer)))
              (gid (or (and (integerp gid) gid)
@@ -2716,7 +2719,7 @@
          (tramp-send-command
           v (format
              "chown %d:%d %s" uid gid
-             (tramp-shell-quote-argument localname)))))
+               (tramp-shell-quote-argument localname))))))
 
     ;; We handle also the local part, because there doesn't exist
     ;; `set-file-uid-gid'.  On W32 "chown" might not work.
@@ -4395,7 +4398,7 @@
                   (tramp-get-remote-gid v 'integer))))
 
       (if (and (tramp-local-host-p v)
-              ;; `file-writable-p' calls 'file-expand-file-name'.  We
+              ;; `file-writable-p' calls `file-expand-file-name'.  We
               ;; cannot use `tramp-run-real-handler' therefore.
               (let (file-name-handler-alist)
                 (and
@@ -4403,7 +4406,7 @@
                  (or (file-directory-p localname)
                      (file-writable-p localname)))))
          ;; Short track: if we are on the local host, we can run directly.
-         (prog1
+         (progn
              (tramp-run-real-handler
               'write-region
               (list start end localname append 'no-message lockname confirm))
@@ -7190,7 +7193,10 @@
        (tramp-file-name-method vec)
        (tramp-file-name-user vec)
        host
-       (tramp-compat-temporary-file-directory))))))
+       (tramp-compat-temporary-file-directory)))
+     ;; On some systems, chown runs only for root.
+     (or (zerop (user-uid))
+        (zerop (tramp-get-remote-uid vec 'integer))))))
 
 ;; Variables local to connection.
 




reply via email to

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