🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by edwards Thu, 22 Sep 1983 03:36
Usefulness of access(2) - (nf)
#131
Author: edwards
Date: Thu, 22 Sep 1983 03:36
22 lines
1383 bytes
#N:uiucuxc:10900002:000:835
uiucuxc!edwards    Sep  2 12:56:00 1983

	I would really like to comment on the function access(2).  The
  manual states that the real user/group id's are used with respect to
  which permissions are checked for access to the files/paths.  And that
  this is useful to set-UID programs.

	Well, it really depends on what you're checking.  If your
  set-UID program wants to do things to privileged areas, then access(2)
  is NOT useful for set-UID programs.
  
  For example: If your set-UID program wants to see if a directory
    exists in a privileged area (access to set-UIDed program/user only,)
    then you can't use access(2) because the real [ug]id of the process
    wouldn't have access anyway.

  Suggestion: eaccess(2) or equivalent to check for effective id's.

			Alan Edwards
			University of Illinois @ Urbana-Champaign
			(...pur-ee!uiucdcs!uiucuxc!edwards)
Re: Usefulness of access(2) - (nf)
#132
Author: mark
Date: Fri, 23 Sep 1983 05:42
34 lines
1636 bytes
NOTE: This is in response to an article in net.bugs, asking for an
      eaccess() system call to check permissions based on effective
      user- and group-ids. I've added net.unix-wizards to the news
      group list, since it belongs there, but shouldn't be stranded
      from the original article.

Rather than another application-specific system call, how about a
more general solution:

	int permiss(path, uid, gid)
	char	*path;
	int	uid;
	int	gid;

Permiss() determines filesystem permissions to 'path' by user 'uid' in
group 'gid'. Returns a value built up from 04 for read-, 02 for write-
and 01 for execute-access.

Permiss() could even replace access(), with a compatibility function
in libc:

extern int
access(path, mode)
char	*path;
int	mode;
{
	return ((permiss(path, getuid(), getgid()) & mode) == 0 ? -1 : 0);
}

This is still a partially-baked idea, but I believe it to be "cleaner"
than access(), and preferable to adding yet another system call.

			Mark Brukhartz
			..!{allegra,ihnp4,ittvax,trsvax}!laidbak!mark
Re: Usefulness of access(2) - (nf)
#137
Author: Mark Brukhartz
Date: Mon, 26 Sep 1983 06:10
33 lines
2279 bytes
In response to spanky!ka, regarding a proposed replacement for access(2):

	I see little need for a function to check for access permission on a
	file by the effective user/group id.  Simply doing a stat(2) on the
	file will achieve the same result.

An eaccess(2) has been proposed to check access by effective user- and group-
ids. Rather than adding another single-purpose system call, I'd rather replace
access(2) with a more general case. There would, of course, be a compatibility
function in libc. Note that stat(2) doesn't check parent directory permissions.

	The problems with the proposed pathaccess system call are twofold.
	First, it would require a lot more work to implement than access.
	Access simply resets the effective id's temporarily and calls nami
	to check the permissions; the proposed new call would have to do its
	own path search.

I didn't say that it would be easy [:-)].

	The second problem has to do with security. Access will perform a
	directory search even if the effective user id doesn't have execute
	permission on a directory. In the case of the more general call, care
	would have to be taken to ensure that such searches didn't create a
	security hole.

Now things become messier. Directory access would have to be restricted by
the effective user- and group-ids of the invoker. This would break access()
when a component directory can by "executed" by the real user- and group-ids,
but not the effective ones. Perhaps this would all be easier with stacked
user- and group-ids, but that "improvement" has been argued already. Oh, well...

				Mark Brukhartz
				..!{allegra,ihnp4,ittral,trsvax}!laidbak!mark
Re: Usefulness of access(2) - (nf)
#135
Author: Kenneth Almquist
Date: Sun, 02 Oct 1983 06:04
14 lines
1388 bytes
I see little need for a function to check for access permission on a file
by the effective user/group id.  Simply doing a stat(2) on the file will
achieve the same result.

The problems with the proposed pathaccess system call are twofold.  First,
it would require a lot more work to implement than access.  Access simply
resets the effective id's temporarily and calls nami to check the permissions;
the proposed new call would have to do its own path search.

The second problem has to do with security.  Access will perform a directory
search even if the effective user id doesn't have execute permission on a
directory.  In the case of the more general call, care would have to be taken
to ensure that such searches didn't create a security hole.
					Kenneth Almquist
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads