From e50352b16beed1f96343f780603b6dca1c9ada3a Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Wed, 13 Nov 1996 00:19:28 +0000 Subject: Thu Nov 7 01:03:11 1996 Thomas Bushnell, n/BSG * protid-rele.c (diskfs_protid_rele): Free CRED->user. Wed Nov 6 17:55:17 1996 Thomas Bushnell, n/BSG * 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 * diskfs.h: Include . (struct protid): Delete members `uids', `gids', `nuids' and `ngids'. New member `user'. --- libdiskfs/protid-make.c | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'libdiskfs/protid-make.c') diff --git a/libdiskfs/protid-make.c b/libdiskfs/protid-make.c index c67bd41b..b61f9d95 100644 --- a/libdiskfs/protid-make.c +++ b/libdiskfs/protid-make.c @@ -37,45 +37,35 @@ 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; - - 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) + { + uid_t zero = 0; + /* Create one for root */ + user = iohelp_create_iouser (make_idvec (), make_idvec ()); + idvec_set_ids (user->uids, &zero, 1); + idvec_set_ids (user->gids, &zero, 1); + cred->user = user; + } else - *cred->gids = 0; + cred->user = iohelp_dup_user (user); mach_port_move_member (mach_task_self (), cred->pi.port_right, diskfs_port_bucket->portset); } -/* 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; } -- cgit v1.2.3