access()
Mike McNally
m5 at lynx.uucp
Tue Jun 6 03:30:15 AEST 1989
Is it appropriate that access("somefile", X_OK) always succeeds
(returns 0), whether "somefile" has an "x" bit or not, when called
while the eff. user id is root?
For the curious, I tested this under 4.3BSD on my Integrated
"Solutions" 68020 box with the following program:
main(ac, av)
int ac;
char **av;
{
printf("%d\n", access(av[1], atoi(av[2])));
}
The program is invoked as "t something 1". When run on a particular
file while not setuid to root, it prints -1 for a plain text file
without any "x" bits. After I setuid to root, the exact same
invocation prints 0. Of course, even while setuid, an attempt to
execute the file fails with EACCES.
Note that I don't want to start another war about the usefulness of
access().
--
Mike McNally Lynx Real-Time Systems
uucp: {voder,athsys}!lynx!m5 phone: 408 370 2233
Where equal mind and contest equal, go.
More information about the Comp.unix.wizards
mailing list