diff options
author | Thomas Bushnell <thomas@gnu.org> | 1996-11-13 00:19:28 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1996-11-13 00:19:28 +0000 |
commit | e50352b16beed1f96343f780603b6dca1c9ada3a (patch) | |
tree | 7e01d93eb2cb0572194be4d3a5765b1502e8e5dc /libdiskfs/io-restrict-auth.c | |
parent | 4bfcb3e730972ec9da6d7c9ce9a768b7a4b9f164 (diff) | |
download | hurd-e50352b16beed1f96343f780603b6dca1c9ada3a.tar.gz hurd-e50352b16beed1f96343f780603b6dca1c9ada3a.tar.bz2 hurd-e50352b16beed1f96343f780603b6dca1c9ada3a.zip |
Thu Nov 7 01:03:11 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* protid-rele.c (diskfs_protid_rele): Free CRED->user.
Wed Nov 6 17:55:17 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* diskfs.h (diskfs_isuid, diskfs_groupmember, diskfs_isowner,
diskfs_access, diskfs_checkdirmod): Delete functions.
* fsys-getroot.c (diskfs_S_fsys_getroot): Replace PSEUDOCRED with
a real iouser and specify that in the relevant calls.
* io-restrict-auth.c (diskfs_S_io_restrict_auth): Reworked to use
idvecs.
* file-chmod.c (diskfs_S_file_chmod): diskfs_isuid ->
idvec_contains.
* file-chown.c (diskfs_S_file_chown): Likewise.
* file-getcontrol.c (diskfs_S_file_getcontrol): Likewise.
* file-chmod.c (diskfs_S_file_chmod): diskfs_groupmember ->
idvec_contains.
* file-chown.c (diskfs_S_file_chown): Likewise.
* node-create.c (diskfs_create_node): Likewise.
* dir-lookup.c (diskfs_S_dir_lookup): diskfs_isowner ->
fshelp_isowner.
* file-chflags.c (diskfs_S_file_chflags): Likewise.
* file-chmod.c (diskfs_S_file_chmod): Likewise.
* file-chown.c (diskfs_S_file_chown): Likewise.
* file-get-transcntl.c (diskfs_S_file_get_translator_cntl):
Likewise.
* file-set-trans.c (diskfs_S_file_set_translator): Likewise.
* file-utimes.c (diskfs_S_file_utimes): Likewise.
* fsys-getroot.c (diskfs_S_fsys_getroot): Likewise.
* lithp.h (dithkfth_ithowner): Deleted macro.
(fthhelp_ithowner, uther): New macros.
* file-chauthor.c (dithkfth_TH_file_chauthor): dthkfth_ithowner ->
fthhelp_ithowner.
* dir-lookup.c (diskfs_S_dir_lookup): diskfs_access ->
fshelp_access.
* dir-mkfile.c (diskfs_S_dir_mkfile): Likewise.
* file-access.c (diskfs_S_file_check_access): Likewise.
* file-exec.c (diskfs_S_file_exec): Likewise (in dead code).
* fsys-getroot.c (diskfs_S_fsys_getroot): Likewise.
* ifsock.c (diskfs_S_ifsock_getsockaddr): Likewise.
* lookup.c (diskfs_lookup): Likewise.
(diskfs_lookup): diskfs_checkdirmod -> fshelp_checkdirmod.
* dir-lookup.c (diskfs_S_dir_lookup): New arg format for
fshelp_fetch_root.
* fsys-getroot.c (diskfs_S_fsys_getroot): Likewise.
* diskfs.h, protid-make.c (diskfs_create_protid): Delete args
`uids', `gids', `nuids', and `ngids'. Replace with new arg
`user'. All callers changed.
(diskfs_finish_protid): Likewise.
* file-inv-trans.c (diskfs_S_file_invoke_translator): Use
CRED->user instead of old fields.
* io-restrict-auth.c (diskfs_S_io_restrict_auth): Likewise.
* node-create.c (diskfs_create_node): Likewise.
* file-exec.c (diskfs_S_file_exec): Likewise. Use idvec_merge
instead of idvec_merge_ids, now that it's convenient.
* io-reauthenticate.c (diskfs_S_io_reauthenticate): Use new
iohelp_reauthenticate.
Tue Nov 5 21:10:18 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* diskfs.h: Include <idvec.h>.
(struct protid): Delete members `uids', `gids', `nuids' and
`ngids'. New member `user'.
Diffstat (limited to 'libdiskfs/io-restrict-auth.c')
-rw-r--r-- | libdiskfs/io-restrict-auth.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/libdiskfs/io-restrict-auth.c b/libdiskfs/io-restrict-auth.c index 30ecf91b..76e15dfa 100644 --- a/libdiskfs/io-restrict-auth.c +++ b/libdiskfs/io-restrict-auth.c @@ -40,37 +40,34 @@ diskfs_S_io_restrict_auth (struct protid *cred, u_int ngids) { error_t err; - uid_t *newuids, *newgids; - int i, newnuids, newngids; + struct idvec *uvec, *gvec; struct protid *newpi; if (!cred) return EOPNOTSUPP; + + uvec = make_idvec (); + gvec = make_idvec (); - if (diskfs_isuid (0, cred)) - /* CRED has root access, and so may use any ids. */ + if (idvec_contains (cred->user->uids, 0)) { - newuids = uids; - newnuids = nuids; - newgids = gids; - newngids = ngids; + /* CRED has root access, and so may use any ids. */ + idvec_set_ids (uvec, uids, nuids); + idvec_set_ids (gvec, gids, ngids); } else - /* Otherwise, use any of the requested ids that CRED already has. */ { - newuids = alloca (sizeof (uid_t) * cred->nuids); - newgids = alloca (sizeof (uid_t) * cred->ngids); - - for (i = newnuids = 0; i < cred->nuids; i++) - if (listmember (uids, cred->uids[i], nuids)) - newuids[newnuids++] = cred->uids[i]; - for (i = newngids = 0; i < cred->ngids; i++) - if (listmember (gids, cred->gids[i], ngids)) - newgids[newngids++] = cred->gids[i]; + /* Otherwise, use any of the requested ids that CRED already has. */ + for (i = 0; i < cred->user->uids->num; i++) + if (listmember (uids, cred->user->uids->ids[i], nuids)) + idvec_add (uvec, cred->user->uids->ids[i]); + for (i = 0; i < cred->user->gids->num; i++) + if (listmember (gids, cred->user->gids->ids[i], ngids)) + idvec_add (gvec, cred->user->gids->ids[i]) } mutex_lock (&cred->po->np->lock); - err = diskfs_create_protid (cred->po, newuids, newnuids, newgids, newngids, + err = diskfs_create_protid (cred->po, iohelp_create_iouser (uvec, gvec), &newpi); if (! err) { |