[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp ChangeLog server.el
From: |
Juanma Barranquero |
Subject: |
[Emacs-diffs] emacs/lisp ChangeLog server.el |
Date: |
Sat, 19 Sep 2009 14:56:08 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Juanma Barranquero <lektu> 09/09/19 14:56:07
Modified files:
lisp : ChangeLog server.el
Log message:
This fixes bug#4197 (merged to bug#865, though not identical).
* server.el (server-auth-dir): Add docstring note about FAT32.
(server-ensure-safe-dir): Accept FAT32 directories as "safe",
but warn against using them.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16209&r2=1.16210
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/server.el?cvsroot=emacs&r1=1.196&r2=1.197
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16209
retrieving revision 1.16210
diff -u -b -r1.16209 -r1.16210
--- ChangeLog 19 Sep 2009 11:45:10 -0000 1.16209
+++ ChangeLog 19 Sep 2009 14:56:04 -0000 1.16210
@@ -1,3 +1,11 @@
+2009-09-19 Juanma Barranquero <address@hidden>
+ Eli Zaretskii <address@hidden>
+
+ This fixes bug#4197 (merged to bug#865, though not identical).
+ * server.el (server-auth-dir): Add docstring note about FAT32.
+ (server-ensure-safe-dir): Accept FAT32 directories as "safe",
+ but warn against using them.
+
2009-09-19 Nick Roberts <address@hidden>
* progmodes/gdb-mi.el (gdb-var-update-handler-1): Include case of
Index: server.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/server.el,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -b -r1.196 -r1.197
--- server.el 18 Sep 2009 16:55:24 -0000 1.196
+++ server.el 19 Sep 2009 14:56:07 -0000 1.197
@@ -113,7 +113,12 @@
(put 'server-host 'risky-local-variable t)
(defcustom server-auth-dir (locate-user-emacs-file "server/")
- "Directory for server authentication files."
+ "Directory for server authentication files.
+
+NOTE: On FAT32 filesystems, directories are not secure;
+files can be read and modified by any user or process.
+It is strongly suggested to set `server-auth-dir' to a
+directory residing in a NTFS partition instead."
:group 'server
:type 'directory
:version "22.1")
@@ -453,11 +458,31 @@
(unless attrs
(letf (((default-file-modes) ?\700)) (make-directory dir t))
(setq attrs (file-attributes dir 'integer)))
+
;; Check that it's safe for use.
- (unless (and (eq t (car attrs)) (eql (nth 2 attrs) (user-uid))
- (or (eq system-type 'windows-nt)
- (zerop (logand ?\077 (file-modes dir)))))
- (error "The directory %s is unsafe" dir))))
+ (let* ((uid (nth 2 attrs))
+ (w32 (eq system-type 'windows-nt))
+ (safe (catch :safe
+ (unless (eq t (car attrs)) ; is a dir?
+ (throw :safe nil))
+ (when (and w32 (zerop uid)) ; on FAT32?
+ (display-warning
+ 'server
+ (format "Using `%s' to store Emacs-server authentication
files.
+Directories on FAT32 filesystems are NOT secure against tampering.
+See variable `server-auth-dir' for details."
+ (file-name-as-directory dir))
+ :warning)
+ (throw :safe t))
+ (unless (eql uid (user-uid)) ; is the dir ours?
+ (throw :safe nil))
+ (when w32 ; on NTFS?
+ (throw :safe t))
+ (unless (zerop (logand ?\077 (file-modes dir)))
+ (throw :safe nil))
+ t)))
+ (unless safe
+ (error "The directory `%s' is unsafe" dir)))))
;;;###autoload
(defun server-start (&optional leave-dead)