Path: utzoo!mnetor!uunet!husc6!rutgers!rochester!cornell!uw-beaver!tektronix!tekgen!teksce!johnhi
From: johnhi@teksce.SCE.TEK.COM (John Higley)
Newsgroups: comp.unix.questions
Subject: Why am I getting this failure?
Message-ID: <897@teksce.SCE.TEK.COM>
Date: 12 Dec 87 01:00:08 GMT
Reply-To: johnhi@teksce.UUCP (John Higley)
Organization: Tektronix, Inc., Beaverton,  OR.
Lines: 43
Keywords: A short C program is included

Given the following code segment and two unrelated users:


---------------------------cut---------------------------------
#include 

extern int
  errno;
extern char
  *sys_errlist[];

main()
{
  FILE
    *testfile;

  if ((testfile=fopen("junkfile","r")) == NULL)
    fprintf(stderr,"Unable to open file - %s\n",sys_errlist[errno]);
}
---------------------------cut---------------------------------


User 1  owns the program  sets it up with the mode 4755 (-rwsr-xr-x)

User 2 creates a directory (junkdir) and a file (junkdir/junkfile)
The mode on junkdir is 700   junkfile is 644

User 2 goes into junkdir and executes the program.

The program should fail with Permission denied

User 2 changes mode on junkdir to 701 (o+x), and executes the program again.

The program fails with Permission denied.   (Why?)

User 2 changes mode on junkdir to 710 or 711 (g+x) and executes again.

The program succeeds.  (Why does fopen need group execute on the directory
when the two users are not in the same group????)


					John Higley
					johnhi@teksce.SCE.TEK.COM.UUCP