From 1e156105080b6168f7fd22574dda6140dc5454de Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Mon, 18 Nov 1996 23:51:17 +0000 Subject: Mon Nov 18 17:06:39 1996 Thomas Bushnell, n/BSG * 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 * 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 * 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. --- libnetfs/fsys-getroot.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'libnetfs/fsys-getroot.c') diff --git a/libnetfs/fsys-getroot.c b/libnetfs/fsys-getroot.c index f7f40385..a0de21c6 100644 --- a/libnetfs/fsys-getroot.c +++ b/libnetfs/fsys-getroot.c @@ -37,16 +37,22 @@ netfs_S_fsys_getroot (mach_port_t cntl, { struct port_info *pt = ports_lookup_port (netfs_port_bucket, cntl, netfs_control_class); - struct netcred *cred; + struct iouser *cred; error_t err; struct protid *newpi; mode_t type; + struct idvec *uvec, *gvec; if (!pt) return EOPNOTSUPP; ports_port_deref (pt); - cred = netfs_make_credential (uids, nuids, gids, ngids); + uvec = make_idvec (); + gvec = make_idvec (); + idvec_set_ids (uvec, uids, nuids); + idvec_set_ids (gvec, gids, ngids); + + cred = iohelp_create_iouser (uvec, gvec); flags &= O_HURD; @@ -62,14 +68,14 @@ netfs_S_fsys_getroot (mach_port_t cntl, && !(flags & O_NOTRANS)) { err = fshelp_fetch_root (&netfs_root_node->transbox, - &dotdot, dotdot, uids, nuids, - gids, ngids, flags, + &dotdot, dotdot, cred, flags, _netfs_translator_callback1, _netfs_translator_callback2, do_retry, retry_name, retry_port); if (err != ENOENT) { mutex_unlock (&netfs_root_node->lock); + iohelp_free_iouser (cred); if (!err) *retry_port_type = MACH_MSG_TYPE_MOVE_SEND; return err; @@ -84,10 +90,12 @@ netfs_S_fsys_getroot (mach_port_t cntl, err = netfs_attempt_readlink (cred, netfs_root_node, pathbuf); - mutex_unlock (&netfs_root_node->lock); if (err) goto out; + mutex_unlock (&netfs_root_node->lock); + iohelp_free_iouser (cred); + if (pathbuf[0] == '/') { *do_retry = FS_RETRY_MAGICAL; @@ -110,8 +118,8 @@ netfs_S_fsys_getroot (mach_port_t cntl, if ((type == S_IFSOCK || type == S_IFBLK || type == S_IFCHR || type == S_IFIFO) && (flags & (O_READ|O_WRITE|O_EXEC))) { - mutex_unlock (&netfs_root_node->lock); - return EOPNOTSUPP; + err = EOPNOTSUPP; + goto out; } err = netfs_check_open_permissions (cred, netfs_root_node, flags, 0); @@ -131,6 +139,8 @@ netfs_S_fsys_getroot (mach_port_t cntl, ports_port_deref (newpi); out: + if (err) + iohelp_free_iouser (cred); mutex_unlock (&netfs_root_node->lock); return err; } -- cgit v1.2.3