From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#12632: file permissions checking mishandled when setuid Date: Tue, 23 Oct 2012 21:50:31 +0200 Message-ID: <83sj95ary0.fsf@gnu.org> References: <5078CAB6.7020509@cs.ucla.edu> <83fw5h5yo6.fsf@gnu.org> <507B010F.20105@cs.ucla.edu> <831uh06gqd.fsf@gnu.org> <507B15B0.2040802@cs.ucla.edu> <83txtw4xmk.fsf@gnu.org> <507B2354.3030408@cs.ucla.edu> <83sj9g4vy7.fsf@gnu.org> <507BAA6C.2000601@cs.ucla.edu> <83lif74p78.fsf@gnu.org> <507C823D.40304@cs.ucla.edu> <83d30j3wqg.fsf@gnu.org> <507CF802.6000305@cs.ucla.edu> <83a9vm4bmv.fsf@gnu.org> <50818763.80501@cs.ucla.edu> <83wqymz4me.fsf@gnu.org> <5081A1DF.9000009@cs.ucla.edu> <5081ABD6.9060002@cs.ucla.edu> <23r4osd2f9.fsf@fencepost.gnu.org> <50836366.6080600@cs.ucla.edu> <5084E1B2.2020105@cs.ucla.edu> <83ipa2ctl2.fsf@gnu.org> <5085AD9E.7040701@cs.ucla.edu> <838vaycj65.fsf@gnu.org> <5085BB01.2030402@cs.ucla.edu> <836261df2p.fsf@gnu.org> <50862604.30208@cs.ucla.edu> <83vce1b0ja.fsf@gnu.org> <5086EF99.6060008@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1351021942 12262 80.91.229.3 (23 Oct 2012 19:52:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Oct 2012 19:52:22 +0000 (UTC) Cc: 12632@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 23 21:52:30 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TQkWb-00035N-CP for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Oct 2012 21:52:29 +0200 Original-Received: from localhost ([::1]:33199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQkWT-0006fi-SY for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Oct 2012 15:52:21 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQkWM-0006fM-D5 for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 15:52:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TQkWG-0000zV-J4 for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 15:52:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TQkWG-0000zR-Fh for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 15:52:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TQkY5-0000iY-Tg for bug-gnu-emacs@gnu.org; Tue, 23 Oct 2012 15:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Oct 2012 19:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security patch Original-Received: via spool by 12632-submit@debbugs.gnu.org id=B12632.13510219862691 (code B ref 12632); Tue, 23 Oct 2012 19:54:01 +0000 Original-Received: (at 12632) by debbugs.gnu.org; 23 Oct 2012 19:53:06 +0000 Original-Received: from localhost ([127.0.0.1]:58186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TQkXB-0000hM-Kb for submit@debbugs.gnu.org; Tue, 23 Oct 2012 15:53:05 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:56088) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TQkX9-0000gX-3h for 12632@debbugs.gnu.org; Tue, 23 Oct 2012 15:53:04 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MCD00C0033SM100@a-mtaout20.012.net.il> for 12632@debbugs.gnu.org; Tue, 23 Oct 2012 21:50:33 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MCD00BYS347HSN0@a-mtaout20.012.net.il>; Tue, 23 Oct 2012 21:50:32 +0200 (IST) In-reply-to: <5086EF99.6060008@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:65946 Archived-At: > Date: Tue, 23 Oct 2012 12:27:21 -0700 > From: Paul Eggert > CC: rgm@gnu.org, 12632@debbugs.gnu.org > > Rather than try to fix these problems, which are on a platform > I'm not familiar with, I'll change the proposed code to > do the following. This should be safe since it is what the > trunk currently does now (modulo some refactoring) when on > DOS or Windows platforms. And it can be tuned for DOS and > Windows later, as needed. > > /* If FILE is a searchable directory or a symlink to a > searchable directory, return true. Otherwise return > false and set errno to an error number. */ > bool > file_accessible_directory_p (char const *file) > { > #ifdef DOS_NT > /* File names may have drive prefixes and "/" is not the only > separator, so the POSIXish approach doesn't work in general. > Use a straightforward approach instead. */ > return file_directory_p (file) && check_executable (file); Just file_directory_p is enough, the other test adds no useful information that isn't already gathered by the first test. (The executable bit of a directory is invented on DOS_NT platforms, it doesn't exist on disk.)