Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!bellcore!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.bugs.4bsd Subject: Re: bugs in access(2) ? Message-ID: <2308@sun.uucp> Date: Sun, 16-Jun-85 00:26:17 EDT Article-I.D.: sun.2308 Posted: Sun Jun 16 00:26:17 1985 Date-Received: Tue, 18-Jun-85 05:22:38 EDT References: <232@gatech.CSNET> Distribution: net Organization: Sun Microsystems, Inc. Lines: 28 > Bug #1) A call to "access" root" with multiple permission checks > on a file on a read-only disk will return an incorrect result. > > Example: > i = access("/ro/foo", 022) > and foo is on a read-only disk, the routine returns a 0 > (implied "true"). "access" is always called with IREAD, IWRITE, or IEXEC as its second argument; it shouldn't be called with a mode like 022, as it shifts the mode right by 0, 3 or 6 positions, depending on whether you're the owner, not the owner but in the group that owns the file, or none of the above. > Bug #2) Root is shown as having "execute" access to everything. > This isn't correct for files which are not executable. In V6, the super-user didn't have execute access unless the appropriate execute bit was set. This was changed before V7 came out, so that the super-user would have search permission on all directories. In both 4.2 and S5R2, the "exec" system call requires "access(ip, IEXEC)" to return 0, requires that the file be a plain file, *and* requires that at least one of the execute permission bits be set; since the code is almost identical, I assume that this dates back to when the change was made. As such, root has execute access to all files which are executable; this requires that somebody must have execute permission on the file, so even "root" can't execute a file with mode rw-r--r--, for instance. Guy Harris