From 4164e4b0eabd69d9c14a05bdca869c49bd5a99b5 Mon Sep 17 00:00:00 2001
From: Thomas Bushnell <thomas@gnu.org>
Date: Mon, 18 Nov 1996 23:59:08 +0000
Subject: Sat Nov 16 17:21:40 1996  Thomas Bushnell, n/BSG 
 <thomas@gnu.ai.mit.edu>

	* inode.c (diskfs_S_fsys_getfile): Delete var `fakecred'.
	diskfs_access -> fshelp_access.
	* alloc.c (ffs_alloc): diskfs_isuid -> idvec_contains.
	(ffs_realloccg): Likewise.

Thu Nov 14 16:43:36 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>

	* inode.c (diskfs_S_file_getfh): diskfs_isuid -> idvec_contains.
	(diskfs_S_fsys_getfile): Use idvecs and iousers.
---
 ufs/ChangeLog | 12 ++++++++++++
 ufs/alloc.c   |  5 +++--
 ufs/inode.c   | 27 ++++++++++++++++-----------
 3 files changed, 31 insertions(+), 13 deletions(-)

(limited to 'ufs')

diff --git a/ufs/ChangeLog b/ufs/ChangeLog
index 2c81dbc3..4ca29dee 100644
--- a/ufs/ChangeLog
+++ b/ufs/ChangeLog
@@ -1,3 +1,15 @@
+Sat Nov 16 17:21:40 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+
+	* inode.c (diskfs_S_fsys_getfile): Delete var `fakecred'.  
+	diskfs_access -> fshelp_access.
+	* alloc.c (ffs_alloc): diskfs_isuid -> idvec_contains.
+	(ffs_realloccg): Likewise.
+
+Thu Nov 14 16:43:36 1996  Thomas Bushnell, n/BSG  <thomas@gnu.ai.mit.edu>
+
+	* inode.c (diskfs_S_file_getfh): diskfs_isuid -> idvec_contains. 
+	(diskfs_S_fsys_getfile): Use idvecs and iousers.
+
 Thu Oct 24 16:07:17 1996  Miles Bader  <miles@gnu.ai.mit.edu>
 
 	* main.c (startup_children, runtime_children): New variables.
diff --git a/ufs/alloc.c b/ufs/alloc.c
index 90ce68f5..15d53180 100644
--- a/ufs/alloc.c
+++ b/ufs/alloc.c
@@ -247,7 +247,7 @@ ffs_alloc(register struct node *np,
 	spin_lock (&alloclock);
 	if (size == fs->fs_bsize && fs->fs_cstotal.cs_nbfree == 0)
 		goto nospace;
-	if (cred && !diskfs_isuid (0, cred)
+	if (cred && !idvec_contains (cred->user->uids, 0)
 	    && freespace(fs, fs->fs_minfree) <= 0)
 		goto nospace;
 #ifdef QUOTA
@@ -323,7 +323,8 @@ ffs_realloccg(register struct node *np,
 
 	spin_lock (&alloclock);
 	
-	if (!diskfs_isuid (0, cred) && freespace(fs, fs->fs_minfree) <= 0)
+	if (!idvec_contains (cred->user->uids, 0) 
+	    && freespace(fs, fs->fs_minfree) <= 0)
 		goto nospace;
 	error = diskfs_catch_exception ();
 	if (error)
diff --git a/ufs/inode.c b/ufs/inode.c
index 47aa6ac9..a0f16642 100644
--- a/ufs/inode.c
+++ b/ufs/inode.c
@@ -716,7 +716,7 @@ diskfs_S_file_getfh (struct protid *cred,
   if (!cred)
     return EOPNOTSUPP;
 
-  if (!diskfs_isuid (0, cred))
+  if (!idvec_contains (cred->user->uids, 0))
     return EPERM;
   
   np = cred->po->np;
@@ -757,7 +757,9 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
   struct ufs_fhandle *f;
   error_t err;
   int flags;
-  struct protid fakecred, *newpi;
+  struct protid *newpi;
+  struct idvec *uvec, *gvec;
+  struct iouser *user;
   
   if (!pt)
     return EOPNOTSUPP;
@@ -784,24 +786,27 @@ diskfs_S_fsys_getfile (mach_port_t fsys,
       return ESTALE;
     }
   
-  /* This call should have a flags arg, but until then... */
-  fakecred.uids = uids;
-  fakecred.gids = gids;
-  fakecred.nuids = nuids;
-  fakecred.ngids = ngids;
+  uvec = make_idvec ();
+  gvec = make_idvec ();
 
+  idvec_set_ids (uvec, uids, nuids);
+  idvec_set_ids (gvec, gids, ngids);
+  user = iohelp_create_iouser (uvec, gvec);
+  
   flags = 0;
-  if (!diskfs_access (np, S_IREAD, &fakecred))
+  if (!fshelp_access (&np->dn_stat, S_IREAD, user))
     flags |= O_READ;
-  if (!diskfs_access (np, S_IEXEC, &fakecred))
+  if (!fshelp_access (&np->dn_stat, S_IEXEC, user))
     flags |= O_EXEC;
-  if (!diskfs_access (np, S_IWRITE, &fakecred)
+  if (!fshelp_access (&np->dn_stat, S_IWRITE, user)
       && !S_ISDIR (np->dn_stat.st_mode)
       && !diskfs_check_readonly ())
     flags |= O_WRITE;
   
   err = diskfs_create_protid (diskfs_make_peropen (np, flags, MACH_PORT_NULL),
-			      uids, nuids, gids, ngids, &newpi);
+			      user, &newpi);
+  
+  iohelp_free_iouser (user);
   
   diskfs_nput (np);
   ports_port_deref (pt);
-- 
cgit v1.2.3