From owner-freebsd-standards Wed Oct 23 15: 0:14 2002 Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F39A337B401 for ; Wed, 23 Oct 2002 15:00:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDA7043E4A for ; Wed, 23 Oct 2002 15:00:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g9NM0Ax3021088 for ; Wed, 23 Oct 2002 15:00:10 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g9NM0AHM021087; Wed, 23 Oct 2002 15:00:10 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC79337B404 for ; Wed, 23 Oct 2002 14:56:47 -0700 (PDT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 29A1F43E6A for ; Wed, 23 Oct 2002 14:56:47 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.12.6/8.12.6) with ESMTP id g9NLuk7R020604 for ; Wed, 23 Oct 2002 14:56:46 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.6/8.12.6/Submit) id g9NLukQY020603; Wed, 23 Oct 2002 14:56:46 -0700 (PDT) Message-Id: <200210232156.g9NLukQY020603@www.freebsd.org> Date: Wed, 23 Oct 2002 14:56:46 -0700 (PDT) From: Chris BeHanna To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: standards/44425: getcwd() succeeds even if current dir has perm 000. Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >Number: 44425 >Category: standards >Synopsis: getcwd() succeeds even if current dir has perm 000. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 23 15:00:10 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Chris BeHanna >Release: 4.7 >Organization: >Environment: FreeBSD topperwein.pennasoft.com 4.7-STABLE FreeBSD 4.7-STABLE #0: Mon Oct 21 14:19:21 EDT 2002 behanna@topperwein.pennasoft.com:/raid0/usr/src/sys/TOPPERWEIN i386 >Description: POSIX requires that getcwd() return EACCES if any component of the pathname lacks either read or search permission; however, even in a directory for which the permissions mask is 000, getcwd() succeeds. >How-To-Repeat: Compile the following program: /* * getcwd bug demo */ #include #include #include #include int main(int argc, char* argv[]) { char* retbuf; if ((retbuf = getcwd(NULL, MAXPATHLEN+1)) == NULL) { fprintf(stderr, "getcwd() failed: errno = %d (%s)\n", errno, strerror(errno)); exit(1); } printf("%s\n", retbuf); free(retbuf); exit(0); } as, say gcc -o /tmp/t t.c then do the following: mkdir foo cd foo chmod 000 . /tmp/t >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message