1 |
/* |
/* |
2 |
Copyright (C) 1993,94,95,96,2001 Free Software Foundation |
Copyright (C) 1993,94,95,96,2001,02 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of the GNU Hurd. |
This file is part of the GNU Hurd. |
5 |
|
|
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
The GNU Hurd is distributed in the hope that it will be useful, |
The GNU Hurd is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
40 |
mach_msg_type_name_t replytype, |
mach_msg_type_name_t replytype, |
41 |
mach_port_t *newport, |
mach_port_t *newport, |
42 |
mach_msg_type_name_t *newporttype, |
mach_msg_type_name_t *newporttype, |
43 |
uid_t *uids, u_int nuids, |
uid_t *uids, size_t nuids, |
44 |
uid_t *gids, u_int ngids) |
uid_t *gids, size_t ngids) |
45 |
{ |
{ |
46 |
int i; |
int i; |
47 |
error_t err; |
error_t err; |
48 |
struct trivfs_protid *newcred; |
struct trivfs_protid *newcred; |
49 |
struct idvec *uvec, *gvec; |
struct idvec *uvec, *gvec; |
50 |
struct iouser *user; |
struct iouser *user; |
51 |
|
|
52 |
if (!cred) |
if (!cred) |
53 |
return EOPNOTSUPP; |
return EOPNOTSUPP; |
54 |
|
|
55 |
if (cred->isroot) |
if (cred->isroot) |
56 |
/* CRED has root access, and so may use any ids. */ |
/* CRED has root access, and so may use any ids. */ |
57 |
{ |
{ |
101 |
|
|
102 |
err = ports_create_port (cred->po->cntl->protid_class, |
err = ports_create_port (cred->po->cntl->protid_class, |
103 |
cred->po->cntl->protid_bucket, |
cred->po->cntl->protid_bucket, |
104 |
sizeof (struct trivfs_protid), |
sizeof (struct trivfs_protid), |
105 |
&newcred); |
&newcred); |
106 |
if (err) |
if (err) |
107 |
{ |
{ |
119 |
newcred->user = user; |
newcred->user = user; |
120 |
newcred->hook = cred->hook; |
newcred->hook = cred->hook; |
121 |
|
|
122 |
err = io_restrict_auth (cred->realnode, &newcred->realnode, |
err = io_restrict_auth (cred->realnode, &newcred->realnode, |
123 |
user->uids->ids, user->uids->num, |
user->uids->ids, user->uids->num, |
124 |
user->gids->ids, user->gids->num); |
user->gids->ids, user->gids->num); |
125 |
if (!err && trivfs_protid_create_hook) |
if (!err && trivfs_protid_create_hook) |
126 |
{ |
{ |