summaryrefslogtreecommitdiff
path: root/libdiskfs/fsys-getroot.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1996-11-13 00:19:28 +0000
committerThomas Bushnell <thomas@gnu.org>1996-11-13 00:19:28 +0000
commite50352b16beed1f96343f780603b6dca1c9ada3a (patch)
tree7e01d93eb2cb0572194be4d3a5765b1502e8e5dc /libdiskfs/fsys-getroot.c
parent4bfcb3e730972ec9da6d7c9ce9a768b7a4b9f164 (diff)
Thu Nov 7 01:03:11 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* protid-rele.c (diskfs_protid_rele): Free CRED->user. Wed Nov 6 17:55:17 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * 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 <thomas@gnu.ai.mit.edu> * diskfs.h: Include <idvec.h>. (struct protid): Delete members `uids', `gids', `nuids' and `ngids'. New member `user'.
Diffstat (limited to 'libdiskfs/fsys-getroot.c')
-rw-r--r--libdiskfs/fsys-getroot.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/libdiskfs/fsys-getroot.c b/libdiskfs/fsys-getroot.c
index 9db349c9..62cf0b1a 100644
--- a/libdiskfs/fsys-getroot.c
+++ b/libdiskfs/fsys-getroot.c
@@ -46,12 +46,19 @@ diskfs_S_fsys_getroot (fsys_t controlport,
mode_t type;
struct protid pseudocred;
struct protid *newpi;
+ struct iouser user;
if (!pt)
return EOPNOTSUPP;
flags &= O_HURD;
+ user.uids = make_idvec ();
+ user.gids = make_idvec ();
+ idvec_set_ids (user.uids, uids, nuids);
+ idvec_set_ids (uesr.gids, gids, ngids);
+#define drop_idvec() idvec_free (user.gids); idvec_free (user.uids)
+
rwlock_reader_lock (&diskfs_fsys_lock);
mutex_lock (&diskfs_root_node->lock);
@@ -66,8 +73,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
&& !(flags & O_NOTRANS))
{
error = fshelp_fetch_root (&diskfs_root_node->transbox,
- &dotdot, dotdot, uids, nuids,
- gids, ngids, flags,
+ &dotdot, dotdot, &user, flags,
_diskfs_translator_callback1,
_diskfs_translator_callback2,
retry, retryname, returned_port);
@@ -75,6 +81,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
{
mutex_unlock (&diskfs_root_node->lock);
rwlock_reader_unlock (&diskfs_fsys_lock);
+ drop_idvec ();
if (!error)
*returned_port_poly = MACH_MSG_TYPE_MOVE_SEND;
return error;
@@ -101,7 +108,10 @@ diskfs_S_fsys_getroot (fsys_t controlport,
mutex_unlock (&diskfs_root_node->lock);
rwlock_reader_unlock (&diskfs_fsys_lock);
if (error)
- return error;
+ {
+ drop_idvec ();
+ return error;
+ }
if (pathbuf[0] == '/')
{
@@ -110,6 +120,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
*returned_port_poly = MACH_MSG_TYPE_COPY_SEND;
strcpy (retryname, pathbuf);
mach_port_deallocate (mach_task_self (), dotdot);
+ drop_idvec ();
return 0;
}
else
@@ -118,6 +129,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
*returned_port = dotdot;
*returned_port_poly = MACH_MSG_TYPE_MOVE_SEND;
strcpy (retryname, pathbuf);
+ drop_idvec ();
return 0;
}
}
@@ -127,17 +139,11 @@ diskfs_S_fsys_getroot (fsys_t controlport,
&& (flags & (O_READ|O_WRITE|O_EXEC)))
error = EOPNOTSUPP;
- /* diskfs_access requires a cred; so we give it one. */
- pseudocred.uids = uids;
- pseudocred.gids = gids;
- pseudocred.nuids = nuids;
- pseudocred.ngids = ngids;
-
if (!error && (flags & O_READ))
- error = diskfs_access (diskfs_root_node, S_IREAD, &pseudocred);
+ error = fshelp_access (&diskfs_root_node->dn_stat, S_IREAD, &user);
if (!error && (flags & O_EXEC))
- error = diskfs_access (diskfs_root_node, S_IEXEC, &pseudocred);
+ error = fshelp_access (&diskfs_root_node->dn_stat, S_IEXEC, &user);
if (!error && (flags & (O_WRITE)))
{
@@ -146,25 +152,28 @@ diskfs_S_fsys_getroot (fsys_t controlport,
else if (diskfs_check_readonly ())
error = EROFS;
else
- error = diskfs_access (diskfs_root_node, S_IWRITE, &pseudocred);
+ error = fshelp_access (&diskfs_root_node->dn_stat,
+ S_IWRITE, &pseudocred.user);
}
if (error)
{
mutex_unlock (&diskfs_root_node->lock);
rwlock_reader_unlock (&diskfs_fsys_lock);
+ drop_idvec ();
return error;
}
if ((flags & O_NOATIME)
- && (diskfs_isowner (diskfs_root_node, &pseudocred) == EPERM))
+ && (fshelp_isowner (&diskfs_root_node->dn_stat, &user)
+ == EPERM))
flags &= ~O_NOATIME;
flags &= ~OPENONLY_STATE_MODES;
error = diskfs_create_protid (diskfs_make_peropen (diskfs_root_node,
flags, dotdot),
- uids, nuids, gids, ngids, &newpi);
+ &user, &newpi);
mach_port_deallocate (mach_task_self (), dotdot);
if (! error)
{
@@ -180,5 +189,7 @@ diskfs_S_fsys_getroot (fsys_t controlport,
ports_port_deref (pt);
+ drop_idvec ();
+
return error;
}