diff options
author | Miles Bader <miles@gnu.org> | 1996-11-11 20:13:09 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 1996-11-11 20:13:09 +0000 |
commit | 6eb5335516a666c3fda42249082baaca0226e2e5 (patch) | |
tree | 0a614766629db1a86d773e5ee9cb82c257bc50b2 | |
parent | 4eb5aea93d0475ca69c5e4538736dfcdc7810a6c (diff) |
(trivfs_S_io_restrict_auth):
If CRED has root, use the requested id sets verbatim.
-rw-r--r-- | libtrivfs/io-restrict-auth.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/libtrivfs/io-restrict-auth.c b/libtrivfs/io-restrict-auth.c index ac915896..f464cbb3 100644 --- a/libtrivfs/io-restrict-auth.c +++ b/libtrivfs/io-restrict-auth.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1993, 1994, 1995 Free Software Foundation + Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation This file is part of the GNU Hurd. @@ -52,14 +52,26 @@ trivfs_S_io_restrict_auth (struct trivfs_protid *cred, if (!cred) return EOPNOTSUPP; - 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->gids[i]; i++) - if (listmember (gids, cred->gids[i], ngids)) - newgids[newngids++] = cred->gids[i]; + if (cred->isroot) + /* CRED has root access, and so may use any ids. */ + { + newuids = uids; + newnuids = nuids; + newgids = gids; + newngids = 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->gids[i]; i++) + if (listmember (gids, cred->gids[i], ngids)) + newgids[newngids++] = cred->gids[i]; + } err = ports_create_port (cred->po->cntl->protid_class, cred->po->cntl->protid_bucket, |