diff options
author | Thomas Bushnell <thomas@gnu.org> | 1996-11-18 23:51:17 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1996-11-18 23:51:17 +0000 |
commit | 1e156105080b6168f7fd22574dda6140dc5454de (patch) | |
tree | 3dfdcc6f84b81e2a983621d4fd2f696c62d11528 /libnetfs/io-restrict-auth.c | |
parent | d79de6fd652140aa4d9a5fd9405466f8cc0d6386 (diff) | |
download | hurd-1e156105080b6168f7fd22574dda6140dc5454de.tar.gz hurd-1e156105080b6168f7fd22574dda6140dc5454de.tar.bz2 hurd-1e156105080b6168f7fd22574dda6140dc5454de.zip |
Mon Nov 18 17:06:39 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* netfs.h (netfs_report_access): Return error_t.
* file-check-access.c (netfs_S_file_check_access): Deal with
errors from netfs_report_access.
Sat Nov 16 17:17:50 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* io-restrict-auth.c (netfs_S_io_restrict_auth): Fix several typos.
* fsys-getroot.c (netfs_S_fsys_getroot): iohelp_make_iouser ->
iohelp_create_iouser. New arg syntax for fshelp_fetch_root.
Fri Nov 15 13:39:03 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* netfs.h (struct protid): Replace member `credential' with `user'
of new type. All uses of old `credential' member changed to
use `user' member.
Change all functions that used to take `struct netcred' args to
take `struct iouser' args. All callers changed.
(netfs_copy_credential, netfs_dropy_credential,
netfs_make_credential): Delete functions.
* dir-lookup.c (netfs_S_dir_lookup): netfs_copy_credential ->
iohelp_dup_iouser.
* dir-mkfile.c (netfs_S_dir_mkfile): Likewise.
* file-exec.c (netfs_S_file_exec): Likewise.
* io-duplicate.c (netfs_S_io_duplicate): Likewise.
* release-protid.c (netfs_release_protid): netfs_drop_credential
-> iohelp_free_iouser.
* dir-lookup.c (netfs_S_dir_lookup): Omit uses of
netfs_interpret_credential; do it with new structures.
* file-exec.c (netfs_S_file_exec): Likewise.
* file-getcontrol.c (netfs_S_file_getcontrol): Likewise.
* file-set-translator.c (netfs_S_file_set_translator): Likewise;
using fshelp_isowner for permission check.
* io-restrict-auth.c (netfs_S_io_restrict_auth): Likewise; guts
rewritten.
* dir-lookup.c (netfs_S_dir_lookup): netfs_make_credential ->
iohelp_make_iouser.
* fsys-getroot.c (netfs_S_fsys_getroot): Likewise.
* fsys-syncfs.c (netfs_S_fsys_syncfs): Likewise.
* io-reauthenticate.c (netfs_S_io_reauthenticate): Use
iohelp_reauth instead of doing it by hand.
Diffstat (limited to 'libnetfs/io-restrict-auth.c')
-rw-r--r-- | libnetfs/io-restrict-auth.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/libnetfs/io-restrict-auth.c b/libnetfs/io-restrict-auth.c index 1a175a35..9d1fda3c 100644 --- a/libnetfs/io-restrict-auth.c +++ b/libnetfs/io-restrict-auth.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -40,28 +40,34 @@ netfs_S_io_restrict_auth (struct protid *user, gid_t *gids, mach_msg_type_number_t ngids) { - uid_t *newuids, *newgids, *olduids, *oldgids; - int i, newnuids, newngids, oldnuids, oldngids; + struct idvec *uvec, *gvec; + int i; struct protid *newpi; if (!user) return EOPNOTSUPP; - mutex_lock (&user->po->np->lock); - netfs_interpret_credential (user->credential, &olduids, &oldnuids, - &oldgids, &oldngids); - newuids = alloca (sizeof (uid_t) * oldnuids); - newgids = alloca (sizeof (gid_t) * oldngids); - for (i = newnuids = 0; i < oldnuids; i++) - if (listmember (uids, olduids[i], nuids)) - newuids[newnuids++] = olduids[i]; - for (i = newngids = 0; i < oldngids; i++) - if (listmember (gids, oldgids[i], ngids)) - newgids[newngids++] = oldgids[i]; + uvec = make_idvec (); + gvec = make_idvec (); + + if (idvec_contains (user->user->uids, 0)) + { + idvec_set_ids (uvec, uids, nuids); + idvec_set_ids (gvec, gids, ngids); + } + else + { + for (i = 0; i < user->user->uids->num; i++) + if (listmember (uids, user->user->uids->ids[i], nuids)) + idvec_add (uvec, user->user->uids->ids[i]); + + for (i = 0; i < user->user->gids->num; i++) + if (listmember (gids, user->user->gids->ids[i], ngids)) + idvec_add (gvec, user->user->gids->ids[i]); + } - newpi = netfs_make_protid (user->po, - netfs_make_credential (newuids, newnuids, - newgids, newngids)); + mutex_lock (&user->po->np->lock); + newpi = netfs_make_protid (user->po, iohelp_create_iouser (uvec, gvec)); *newport = ports_get_right (newpi); mutex_unlock (&user->po->np->lock); |