tramp-devel
[Top][All Lists]
Advanced

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

su(do) vs SELinux


From: Andr
Subject: su(do) vs SELinux
Date: Thu, 05 Nov 2009 02:30:14 +0200
User-agent: Wanderlust/2.15.7 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1.50 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Hello, trampers,
as known, after su(do)-ing a file with Tramp, there may be a problem
when using SELinux regarding changed domain type.  This is due to the
temporary file caring its flawed SELinux context.  However, if the
temp file is copied instead of moved over the original, original
context is kept without dealing with special commands.  This little
change to tramp-handle-write-region seems to do the job, if not, at
least you get an idea ;)

diff -u tramp-cvs.el tramp.el
--- tramp-cvs.el        2009-10-30 00:44:58.187239975 +0200
+++ tramp.el    2009-10-30 01:19:06.061487325 +0200
@@ -4926,22 +4926,26 @@
          ((or (tramp-local-host-p v)
               (tramp-method-out-of-band-p
                v (- (or end (point-max)) (or start (point-min)))))
-           (condition-case err
-               (if (and (= (or end (point-max)) (point-max))
-                        (= (or start (point-min)) (point-min))
-                        (tramp-get-method-parameter
-                         method 'tramp-copy-keep-tmpfile))
-                   (progn
+           (if (and (= (or end (point-max)) (point-max))
+                    (= (or start (point-min)) (point-min))
+                    (tramp-get-method-parameter
+                     method 'tramp-copy-keep-tmpfile))
+               (progn
+                 (setq tramp-temp-buffer-file-name tmpfile)
+                 (condition-case err
                     ;; We keep the local file for performance
                     ;; reasons, useful for "rsync".
-                     (setq tramp-temp-buffer-file-name tmpfile)
-                     (copy-file tmpfile filename t))
-                 (setq tramp-temp-buffer-file-name nil)
-                 (rename-file tmpfile filename t))
-             ((error quit)
-              (setq tramp-temp-buffer-file-name nil)
-              (delete-file tmpfile)
-              (signal (car err) (cdr err)))))
+                     (copy-file tmpfile filename t)
+                   ((error quit)
+                    (setq tramp-temp-buffer-file-name nil)
+                    (delete-file tmpfile)
+                    (signal (car err) (cdr err)))))
+             (setq tramp-temp-buffer-file-name nil)
+             (condition-case err
+                 (copy-file tmpfile filename t)
+               ((error quit)
+                (signal (car err) (cdr err))))
+             (delete-file tmpfile)))

          ;; Use inline file transfer.
          (rem-dec




reply via email to

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