diff options
Diffstat (limited to 'lisp/net')
-rw-r--r-- | lisp/net/tramp-adb.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-crypt.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-gvfs.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-rclone.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-smb.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-sshfs.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-sudoedit.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp.el | 26 |
9 files changed, 33 insertions, 9 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index dbbbfe6a3f9..8138d9a3608 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -164,7 +164,7 @@ It is used for TCP/IP devices." (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-adb-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . tramp-adb-handle-make-process) (make-symbolic-link . tramp-handle-make-symbolic-link) diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 1b77fea7e18..109db3b1d7b 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -213,7 +213,7 @@ If NAME doesn't belong to a crypted remote directory, retun nil." (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-crypt-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . ignore) (make-symbolic-link . tramp-handle-make-symbolic-link) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 04de5defb37..022fdeeb885 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -805,7 +805,7 @@ It has been changed in GVFS 1.14.") (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-gvfs-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . ignore) (make-symbolic-link . tramp-handle-make-symbolic-link) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 473fa8a8f0e..49e366c01c6 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -127,7 +127,7 @@ (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-fuse-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . ignore) (make-symbolic-link . tramp-handle-make-symbolic-link) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 3595bd26557..760320d7ed4 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -993,7 +993,7 @@ Format specifiers \"%s\" are replaced before the script is used.") (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-sh-handle-make-directory) ;; `make-directory-internal' performed by default handler. - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . tramp-sh-handle-make-process) (make-symbolic-link . tramp-sh-handle-make-symbolic-link) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 1c7ddee0086..4008c25d3af 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -278,7 +278,7 @@ See `tramp-actions-before-shell' for more info.") (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-smb-handle-make-directory) (make-directory-internal . tramp-smb-handle-make-directory-internal) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . ignore) (make-symbolic-link . tramp-smb-handle-make-symbolic-link) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index 5f6807a0db7..99f4063988f 100644 --- a/lisp/net/tramp-sshfs.el +++ b/lisp/net/tramp-sshfs.el @@ -127,7 +127,7 @@ (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-fuse-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . tramp-handle-make-process) (make-symbolic-link . tramp-handle-make-symbolic-link) diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index d68a5c1adf4..45d9fab986c 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -120,7 +120,7 @@ See `tramp-actions-before-shell' for more info.") (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) (make-directory . tramp-sudoedit-handle-make-directory) (make-directory-internal . ignore) - ;; `make-lock-file-name' performed by default handler. + (make-lock-file-name . tramp-handle-make-lock-file-name) (make-nearby-temp-file . tramp-handle-make-nearby-temp-file) (make-process . ignore) (make-symbolic-link . tramp-sudoedit-handle-make-symbolic-link) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9e6bfceb49a..3f586c62170 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3630,7 +3630,7 @@ User is always nil." (file-writable-p (file-name-directory filename))))))) (defcustom tramp-allow-unsafe-temporary-files nil - "Whether root-owned auto-save or backup files can be written to \"/tmp\"." + "Whether root-owned auto-save, backup or lock files can be written to \"/tmp\"." :version "28.1" :type 'boolean) @@ -3880,6 +3880,30 @@ Return nil when there is no lockfile." (write-region info nil lockname) (set-file-modes lockname #o0644)))))))) +(defun tramp-handle-make-lock-file-name (file) + "Like `make-lock-file-name' for Tramp files." + (when (and create-lockfiles + ;; This variable has been introduced with Emacs 28.1. + (not (bound-and-true-p remote-file-name-inhibit-locks))) + (with-parsed-tramp-file-name file nil + (let ((result + ;; Run plain `make-lock-file-name'. + (tramp-run-real-handler #'make-lock-file-name (list file)))) + ;; Protect against security hole. + (when (and (not tramp-allow-unsafe-temporary-files) + (file-in-directory-p result temporary-file-directory) + (zerop (or (tramp-compat-file-attribute-user-id + (file-attributes file 'integer)) + tramp-unknown-id-integer)) + (not (with-tramp-connection-property + (tramp-get-process v) "unsafe-temporary-file" + (yes-or-no-p + (concat + "Lock file on local temporary directory, " + "do you want to continue? "))))) + (tramp-error v 'file-error "Unsafe lock file name")) + result)))) + (defun tramp-handle-unlock-file (file) "Like `unlock-file' for Tramp files." (when-let ((lockname (tramp-compat-make-lock-file-name file))) |