]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Tramp bug#49178
authorMichael Albinus <michael.albinus@gmx.de>
Fri, 25 Jun 2021 12:18:28 +0000 (14:18 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Fri, 25 Jun 2021 12:18:28 +0000 (14:18 +0200)
* lisp/net/tramp.el (tramp-handle-find-backup-file-name)
(tramp-handle-make-auto-save-file-name): Adapt checks.  (Bug#49178)

lisp/net/tramp.el

index 5284981961aa40ab8a7dafa2e5502097a1ff15a9..0f15e4a20b5fc2ed4e00bee90e8452baecc6f42a 100644 (file)
@@ -3648,17 +3648,17 @@ User is always nil."
                     (cdr x))))
                tramp-backup-directory-alist)
             backup-directory-alist))
-         (uid (tramp-compat-file-attribute-user-id
-               (file-attributes filename 'integer)))
          result)
       (prog1 ;; Run plain `find-backup-file-name'.
          (setq result
                (tramp-run-real-handler
                 #'find-backup-file-name (list filename)))
         ;; Protect against security hole.
-       (when (and (natnump uid) (zerop uid)
+       (when (and (not tramp-allow-unsafe-temporary-files)
                   (file-in-directory-p (car result) temporary-file-directory)
-                  (not tramp-allow-unsafe-temporary-files)
+                  (zerop (or (tramp-compat-file-attribute-user-id
+                              (file-attributes filename 'integer))
+                             tramp-unknown-id-integer))
                   (not (with-tramp-connection-property
                            (tramp-get-process v) "unsafe-temporary-file"
                          (yes-or-no-p
@@ -5264,8 +5264,7 @@ this file, if that variable is non-nil."
          (auto-save-file-name-transforms
           (if (null tramp-auto-save-directory)
               auto-save-file-name-transforms))
-         (uid (tramp-compat-file-attribute-user-id
-               (file-attributes buffer-file-name 'integer)))
+         (filename buffer-file-name)
          (buffer-file-name
           (if (null tramp-auto-save-directory)
               buffer-file-name
@@ -5283,9 +5282,11 @@ this file, if that variable is non-nil."
       (prog1 ;; Run plain `make-auto-save-file-name'.
          (setq result (tramp-run-real-handler #'make-auto-save-file-name nil))
        ;; Protect against security hole.
-       (when (and (natnump uid) (zerop uid)
+       (when (and (not tramp-allow-unsafe-temporary-files)
                   (file-in-directory-p result temporary-file-directory)
-                  (not tramp-allow-unsafe-temporary-files)
+                  (zerop (or (tramp-compat-file-attribute-user-id
+                              (file-attributes filename 'integer))
+                             tramp-unknown-id-integer))
                   (not (with-tramp-connection-property
                            (tramp-get-process v) "unsafe-temporary-file"
                          (yes-or-no-p