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/file-set-translator.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'libnetfs/file-set-translator.c') diff --git a/libnetfs/file-set-translator.c b/libnetfs/file-set-translator.c index 4307924a..f09230d6 100644 --- a/libnetfs/file-set-translator.c +++ b/libnetfs/file-set-translator.c @@ -33,8 +33,6 @@ netfs_S_file_set_translator (struct protid *user, { struct node *np; error_t err = 0; - uid_t *uids, *gids; - int nuids, ngids; int i; mach_port_t control; @@ -53,21 +51,14 @@ netfs_S_file_set_translator (struct protid *user, if (active_flags & FS_TRANS_SET) { /* Validate--user must be owner */ - netfs_interpret_credential (user->credential, &uids, &nuids, - &gids, &ngids); - err = netfs_validate_stat (np, user->credential); + err = netfs_validate_stat (np, user->user); if (err) goto out; - for (i = 0; i < nuids; i++) - if (uids[i] == 0 || uids[i] == np->nn_stat.st_uid) - break; - if (i == nuids) - { - mutex_unlock (&np->lock); - return EBUSY; - } - + err = fshelp_isowner (&np->nn_stat, user->user); + if (err) + goto out; + err = fshelp_fetch_control (&np->transbox, &control); if (err) goto out; @@ -87,7 +78,7 @@ netfs_S_file_set_translator (struct protid *user, if ((passive_flags & FS_TRANS_SET) && (passive_flags & FS_TRANS_EXCL)) { - err = netfs_validate_stat (np, user->credential); + err = netfs_validate_stat (np, user->user); if (!err && np->istranslated) err = EBUSY; if (err) @@ -148,7 +139,7 @@ netfs_S_file_set_translator (struct protid *user, } minor = strtol (arg, 0, 0); - err = netfs_attempt_mkdev (user->credential, np, + err = netfs_attempt_mkdev (user->user, np, newmode, makedev (major, minor)); if (err == EOPNOTSUPP) goto fallback; @@ -163,15 +154,15 @@ netfs_S_file_set_translator (struct protid *user, return EINVAL; } - err = netfs_attempt_mksymlink (user->credential, np, arg); + err = netfs_attempt_mksymlink (user->user, np, arg); if (err == EOPNOTSUPP) goto fallback; break; default: - err = netfs_validate_stat (np, user->credential); + err = netfs_validate_stat (np, user->user); if (!err) - err = netfs_attempt_chmod (user->credential, np, + err = netfs_attempt_chmod (user->user, np, ((np->nn_stat.st_mode & ~S_IFMT) | newmode)); if (err == EOPNOTSUPP) @@ -180,7 +171,7 @@ netfs_S_file_set_translator (struct protid *user, case 0: fallback: - err = netfs_set_translator (user->credential, np, + err = netfs_set_translator (user->user, np, passive, passivelen); break; } -- cgit v1.2.3