diff options
Diffstat (limited to 'libdiskfs/protid-make.c')
-rw-r--r-- | libdiskfs/protid-make.c | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c index c67bd41b..9b78a37f 100644 --- a/libdiskfs/protid-make.c +++ b/libdiskfs/protid-make.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1994, 1995, 1996 Free Software Foundation + Copyright (C) 1994,95,96,2001 Free Software Foundation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -17,6 +17,7 @@ #include "priv.h" #include <string.h> +#include <assert.h> /* Build and return in CRED a protid which has no user identification, for peropen PO. The node PO->np must be locked. */ @@ -37,45 +38,32 @@ diskfs_start_protid (struct peropen *po, struct protid **cred) } /* Finish building protid CRED started with diskfs_start_protid; - the uid set is UID (length NUIDS); the gid set is GID (length NGIDS). */ + the user to install is USER. */ void -diskfs_finish_protid (struct protid *cred, uid_t *uids, int nuids, - gid_t *gids, int ngids) +diskfs_finish_protid (struct protid *cred, struct iouser *user) { - if (!uids) - nuids = 1; - if (!gids) - ngids = 1; + error_t err; - cred->uids = malloc (nuids * sizeof (uid_t)); - cred->gids = malloc (ngids * sizeof (uid_t)); - cred->nuids = nuids; - cred->ngids = ngids; - - if (uids) - bcopy (uids, cred->uids, nuids * sizeof (uid_t)); - else - *cred->uids = 0; - - if (gids) - bcopy (gids, cred->gids, ngids * sizeof (uid_t)); + if (!user) + err = iohelp_create_simple_iouser (&cred->user, 0, 0); else - *cred->gids = 0; + err = iohelp_dup_iouser (&cred->user, user); + assert_perror (err); - mach_port_move_member (mach_task_self (), cred->pi.port_right, - diskfs_port_bucket->portset); + err = mach_port_move_member (mach_task_self (), cred->pi.port_right, + diskfs_port_bucket->portset); + assert_perror (err); } -/* Create and return a protid for an existing peropen PO in CRED. The uid - set is UID (length NUIDS); the gid set is GID (length NGIDS). The node - PO->np must be locked. */ +/* Create and return a protid for an existing peropen PO in CRED for USER. + The node PO->np must be locked. */ error_t -diskfs_create_protid (struct peropen *po, uid_t *uids, int nuids, - uid_t *gids, int ngids, struct protid **cred) +diskfs_create_protid (struct peropen *po, struct iouser *user, + struct protid **cred) { error_t err = diskfs_start_protid (po, cred); if (! err) - diskfs_finish_protid (*cred, uids, nuids, gids, ngids); + diskfs_finish_protid (*cred, user); return err; } |