[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100517: Fix comparisons of file o
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100517: Fix comparisons of file ownership on MS-Windows for the Administrator user. |
Date: |
Fri, 11 Mar 2011 14:19:08 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100517
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-23
timestamp: Fri 2011-03-11 14:19:08 +0200
message:
Fix comparisons of file ownership on MS-Windows for the Administrator user.
lisp/files.el (file-ownership-preserved-p): Pass `integer' as an
explicit 2nd argument to `file-attributes'. If the file's owner
is the Administrators group on Windows, and the current user is
Administrator, consider that a match.
lisp/server.el (server-ensure-safe-dir): Consider server directory
safe on MS-Windows if its owner is the Administrators group while
the current Emacs user is Administrator. Use `=' to compare
numerical UIDs, since they could be integers or floats.
modified:
lisp/ChangeLog
lisp/files.el
lisp/server.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2011-03-07 20:05:53 +0000
+++ b/lisp/ChangeLog 2011-03-11 12:19:08 +0000
@@ -1,3 +1,15 @@
+2011-03-11 Eli Zaretskii <address@hidden>
+
+ * files.el (file-ownership-preserved-p): Pass `integer' as an
+ explicit 2nd argument to `file-attributes'. If the file's owner
+ is the Administrators group on Windows, and the current user is
+ Administrator, consider that a match.
+
+ * server.el (server-ensure-safe-dir): Consider server directory
+ safe on MS-Windows if its owner is the Administrators group while
+ the current Emacs user is Administrator. Use `=' to compare
+ numerical UIDs, since they could be integers or floats.
+
2011-03-07 Chong Yidong <address@hidden>
* Version 23.3 released.
=== modified file 'lisp/files.el'
--- a/lisp/files.el 2011-02-18 05:15:22 +0000
+++ b/lisp/files.el 2011-03-11 12:19:08 +0000
@@ -3752,11 +3752,17 @@
(let ((handler (find-file-name-handler file 'file-ownership-preserved-p)))
(if handler
(funcall handler 'file-ownership-preserved-p file)
- (let ((attributes (file-attributes file)))
+ (let ((attributes (file-attributes file 'integer)))
;; Return t if the file doesn't exist, since it's true that no
;; information would be lost by an (attempted) delete and create.
(or (null attributes)
- (= (nth 2 attributes) (user-uid)))))))
+ (= (nth 2 attributes) (user-uid))
+ ;; Files created on Windows by Administrator (RID=500)
+ ;; have the Administrators group (RID=544) recorded as
+ ;; their owner. Rewriting them will still preserve the
+ ;; owner.
+ (and (eq system-type 'windows-nt)
+ (= (user-uid) 500) (= (nth 2 attributes) 544)))))))
(defun file-name-sans-extension (filename)
"Return FILENAME sans final \"extension\".
=== modified file 'lisp/server.el'
--- a/lisp/server.el 2011-01-02 23:50:46 +0000
+++ b/lisp/server.el 2011-03-11 12:19:08 +0000
@@ -474,7 +474,13 @@
(file-name-as-directory dir))
:warning)
(throw :safe t))
- (unless (eql uid (user-uid)) ; is the dir ours?
+ (unless (or (= uid (user-uid)) ; is the dir ours?
+ (and w32
+ ;; Files created on Windows by
+ ;; Administrator (RID=500) have
+ ;; the Administrators (RID=544)
+ ;; group recorded as the owner.
+ (= uid 544) (= (user-uid) 500)))
(throw :safe nil))
(when w32 ; on NTFS?
(throw :safe t))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100517: Fix comparisons of file ownership on MS-Windows for the Administrator user.,
Eli Zaretskii <=