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: Sat, 13 Oct 2012 09:23:02 +0200 Message-ID: <83fw5i7s4p.fsf@gnu.org> References: <5078CAB6.7020509@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1350113053 2361 80.91.229.3 (13 Oct 2012 07:24:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Oct 2012 07:24:13 +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 Sat Oct 13 09:24:20 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 1TMw55-0008JN-QA for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Oct 2012 09:24:20 +0200 Original-Received: from localhost ([::1]:53397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw4y-0001wn-Tj for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Oct 2012 03:24:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw4v-0001wV-Rt for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:24:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMw4u-0005a5-R2 for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:24:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw4u-0005a0-Nl for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:24:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TMw5m-0007Dv-Dz for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:25:02 -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: Sat, 13 Oct 2012 07:25:02 +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: patch X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135011305027705 (code B ref -1); Sat, 13 Oct 2012 07:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Oct 2012 07:24:10 +0000 Original-Received: from localhost ([127.0.0.1]:41874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMw4v-0007Cn-Uu for submit@debbugs.gnu.org; Sat, 13 Oct 2012 03:24:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35862) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TMw4t-0007CL-00 for submit@debbugs.gnu.org; Sat, 13 Oct 2012 03:24:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMw3u-0005Tr-LE for submit@debbugs.gnu.org; Sat, 13 Oct 2012 03:23:07 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:34710) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw3u-0005Tl-IL for submit@debbugs.gnu.org; Sat, 13 Oct 2012 03:23:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw3t-0001t5-BX for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:23:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMw3s-0005Se-6O for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:23:05 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:62864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMw3r-0005SK-UQ for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 03:23:04 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MBT00900LPPBA00@a-mtaout22.012.net.il> for bug-gnu-emacs@gnu.org; Sat, 13 Oct 2012 09:22:59 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MBT009Z7LUB9120@a-mtaout22.012.net.il>; Sat, 13 Oct 2012 09:22:59 +0200 (IST) In-reply-to: <5078CAB6.7020509@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:65544 Archived-At: > Date: Fri, 12 Oct 2012 18:58:14 -0700 > From: Paul Eggert > CC: Eli Zaretskii > > This patch has a four FIXMEs indicating where the code could > most likely be cleaned up on DOS_NT platforms. The patch > should work fine as-is on DOS_NT, but it'd be nicer if the > DOS_NT support could supply an euidaccess function to allow > simplifying the mainline code. I'll CC: this bug report to > Eli to give him a heads-up. The FIXMEs are OK, but I see no reason for them to come _instead_ of comments which explain why 'access' is used instead of 'stat'. Those comments should be removed only when 'euidaccess' is implemented for those platforms. Regarding this hunk: > @@ -2626,8 +2594,7 @@ > should check ACLs though, which do affect this. */ > return (access (SDATA (dir), D_OK) < 0) ? Qnil : Qt; > #else > - return (check_writable (!NILP (dir) ? SSDATA (dir) : "") > - ? Qt : Qnil); > + return check_writable (SSDATA (dir)) ? Qt : Qnil; > #endif How will the new code work if 'dir' is nil? Also, what about lread.c:openp, around line 1555: doesn't it want 'euidaccess' as well, rather than 'stat'? I think using 'euidaccess' there will allow a further optimization, in that the call to 'stat' is not needed at all, because right below it we call either 'access' or 'emacs_open'.