diff options
author | Thomas Bushnell <thomas@gnu.org> | 1996-11-18 23:59:08 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1996-11-18 23:59:08 +0000 |
commit | 4164e4b0eabd69d9c14a05bdca869c49bd5a99b5 (patch) | |
tree | 7fe7723f241969f823b99e504f9da134a3dfae32 /ufs/inode.c | |
parent | fc249f934b77de7fca36bfd398eaf7299be941aa (diff) |
Sat Nov 16 17:21:40 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* inode.c (diskfs_S_fsys_getfile): Delete var `fakecred'.
diskfs_access -> fshelp_access.
* alloc.c (ffs_alloc): diskfs_isuid -> idvec_contains.
(ffs_realloccg): Likewise.
Thu Nov 14 16:43:36 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* inode.c (diskfs_S_file_getfh): diskfs_isuid -> idvec_contains.
(diskfs_S_fsys_getfile): Use idvecs and iousers.
Diffstat (limited to 'ufs/inode.c')
-rw-r--r-- | ufs/inode.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/ufs/inode.c b/ufs/inode.c index 47aa6ac9..a0f16642 100644 --- a/ufs/inode.c +++ b/ufs/inode.c @@ -716,7 +716,7 @@ diskfs_S_file_getfh (struct protid *cred, if (!cred) return EOPNOTSUPP; - if (!diskfs_isuid (0, cred)) + if (!idvec_contains (cred->user->uids, 0)) return EPERM; np = cred->po->np; @@ -757,7 +757,9 @@ diskfs_S_fsys_getfile (mach_port_t fsys, struct ufs_fhandle *f; error_t err; int flags; - struct protid fakecred, *newpi; + struct protid *newpi; + struct idvec *uvec, *gvec; + struct iouser *user; if (!pt) return EOPNOTSUPP; @@ -784,24 +786,27 @@ diskfs_S_fsys_getfile (mach_port_t fsys, return ESTALE; } - /* This call should have a flags arg, but until then... */ - fakecred.uids = uids; - fakecred.gids = gids; - fakecred.nuids = nuids; - fakecred.ngids = ngids; + uvec = make_idvec (); + gvec = make_idvec (); + idvec_set_ids (uvec, uids, nuids); + idvec_set_ids (gvec, gids, ngids); + user = iohelp_create_iouser (uvec, gvec); + flags = 0; - if (!diskfs_access (np, S_IREAD, &fakecred)) + if (!fshelp_access (&np->dn_stat, S_IREAD, user)) flags |= O_READ; - if (!diskfs_access (np, S_IEXEC, &fakecred)) + if (!fshelp_access (&np->dn_stat, S_IEXEC, user)) flags |= O_EXEC; - if (!diskfs_access (np, S_IWRITE, &fakecred) + if (!fshelp_access (&np->dn_stat, S_IWRITE, user) && !S_ISDIR (np->dn_stat.st_mode) && !diskfs_check_readonly ()) flags |= O_WRITE; err = diskfs_create_protid (diskfs_make_peropen (np, flags, MACH_PORT_NULL), - uids, nuids, gids, ngids, &newpi); + user, &newpi); + + iohelp_free_iouser (user); diskfs_nput (np); ports_port_deref (pt); |