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 [EMACS_23_1_RC]


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

CVSROOT:        /sources/emacs
Module name:    emacs
Branch:         EMACS_23_1_RC
Changes by:     Michael Albinus <albinus>       09/07/08 12:52:01

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.  (Bug#3771)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&only_with_tag=EMACS_23_1_RC&r1=1.236.2.4&r2=1.236.2.5

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.236.2.4
retrieving revision 1.236.2.5
diff -u -b -r1.236.2.4 -r1.236.2.5
--- tramp.el    6 Jul 2009 13:40:26 -0000       1.236.2.4
+++ tramp.el    8 Jul 2009 12:52:00 -0000       1.236.2.5
@@ -2687,6 +2687,9 @@
   ;;      succeed in 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)
@@ -2694,7 +2697,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 Win32 "chown" might not work.
@@ -4356,7 +4359,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
@@ -4364,7 +4367,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))
@@ -7161,7 +7164,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]