From: teranisi Date: Sun, 7 Dec 2003 00:39:37 +0000 (+0000) Subject: * mime-play.el (mime-require-safe-directory): Check the owner of the X-Git-Tag: semi-1_14_6~14 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4af0c3eecbac8146059f8d266c9b748599b1f660;p=elisp%2Fsemi.git * mime-play.el (mime-require-safe-directory): Check the owner of the directory if it already exists. --- diff --git a/ChangeLog b/ChangeLog index dfc81db..627085b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-12-07 Yuuichi Teranishi + + * mime-play.el (mime-require-safe-directory): Check the owner of the + directory if it already exists. + 2003-12-06 Yuuichi Teranishi * mime-play.el (mime-require-safe-directory): New function. diff --git a/mime-play.el b/mime-play.el index c766828..a96934e 100644 --- a/mime-play.el +++ b/mime-play.el @@ -351,11 +351,13 @@ It is registered to variable `mime-preview-quitting-method-alist'." The permission of the created directory becomes `700' (for the owner only). If the directory already exists and is writable by other users, an error occurs." - (let ((orig-modes (default-file-modes))) - (if (file-directory-p dir) + (let ((attr (file-attributes dir)) + (orig-modes (default-file-modes))) + (if (and attr (eq (car attr) t)) ; directory already exists. (unless (or (memq system-type '(windows-nt ms-dos OS/2 emx)) - (eq (file-modes dir) 448)) - (error "Invalid permission for %s" dir)) + (and (eq (nth 2 attr) (user-real-uid)) + (eq (file-modes dir) 448))) + (error "Invalid owner or permission for %s" dir)) (unwind-protect (progn (set-default-file-modes 448)