* dtable.cc (dtable::build_fhandler_from_name): Set some fhandler

data on sockets to evaluate AF_LOCAL sockets correctly.
	(dtable::build_fhandler): Set unit number on sockets.
	* fhandler.h (fhandler_socket): Add unit number.
	(fhandler_socket::get_unit): New method.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit
	number.
	(fhandler_socket::fstat): Reorganize to return more Linux-like
	values.
	* net.cc: include ctype.h.
	(fdsock): Set unit number when building fhandler.
	* path.cc (path_conv::check): Set device type to FH_SOCKET if file
	is a AF_UNIX socket.
	(get_devn): Evaluate unit for virtual socket devices.
	(win32_device_name): Set windows path for sockets to unix_path with
	just backslashes to keep the different names.
	* syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev
	for sockets.
	(stat_worker): Ditto.

From Pierre Humblet:

	* autoload.cc (AccessCheck): Add.
	(DuplicateToken): Add.
	* security.h (check_file_access): Declare.
	* syscalls.cc (access): Convert path to Windows, check existence
	and readonly attribute. Call check_file_access instead of acl_access.
	* security.cc (check_file_access): Create.
	* sec_acl (acl_access): Delete.
This commit is contained in:
Corinna Vinschen
2003-02-21 14:29:18 +00:00
parent d05ef21d4f
commit cf762b08cf
11 changed files with 180 additions and 85 deletions

View File

@@ -413,69 +413,6 @@ getacl (const char *file, DWORD attr, int nentries, __aclent32_t *aclbufp)
return pos;
}
int
acl_access (const char *path, int flags)
{
__aclent32_t acls[MAX_ACL_ENTRIES];
int cnt;
if ((cnt = acl32 (path, GETACL, MAX_ACL_ENTRIES, acls)) < 1)
return -1;
/* Only check existence. */
if (!(flags & (R_OK | W_OK | X_OK)))
return 0;
for (int i = 0; i < cnt; ++i)
{
switch (acls[i].a_type)
{
case USER_OBJ:
case USER:
if (acls[i].a_id != myself->uid)
{
/*
* Check if user is a NT group:
* Take SID from passwd, search SID in token groups
*/
cygsid owner;
struct passwd *pw;
if ((pw = internal_getpwuid (acls[i].a_id)) != NULL
&& owner.getfrompw (pw)
&& internal_getgroups (0, NULL, &owner) > 0)
break;
continue;
}
break;
case GROUP_OBJ:
case GROUP:
if (acls[i].a_id != myself->gid)
{
cygsid group;
struct __group32 *gr = NULL;
if ((gr = internal_getgrgid (acls[i].a_id)) != NULL
&& group.getfromgr (gr)
&& internal_getgroups (0, NULL, &group) > 0)
break;
continue;
}
break;
case OTHER_OBJ:
break;
default:
continue;
}
if ((!(flags & R_OK) || (acls[i].a_perm & S_IROTH))
&& (!(flags & W_OK) || (acls[i].a_perm & S_IWOTH))
&& (!(flags & X_OK) || (acls[i].a_perm & S_IXOTH)))
return 0;
}
set_errno (EACCES);
return -1;
}
static
int
acl_worker (const char *path, int cmd, int nentries, __aclent32_t *aclbufp,