DEVEL15-solaris10-suser-replace-20070102
authorDale Ghent <daleg@umbc.edu>
Tue, 2 Jan 2007 07:34:46 +0000 (07:34 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 2 Jan 2007 07:34:46 +0000 (07:34 +0000)
FIXES 50246

suser is dead, long live suser

(cherry picked from commit 71f6f346caa9f501a0b7af23c9d4425d9357f3eb)

src/afs/SOLARIS/osi_inode.c
src/afs/SOLARIS/osi_machdep.h
src/afs/SOLARIS/osi_vfsops.c

index 5e0d581..d352e32 100644 (file)
@@ -158,7 +158,7 @@ afs_syscall_icreate(dev, near_inode, param1, param2, param3, param4, rvp,
 
     AFS_STATCNT(afs_syscall_icreate);
 
-    if (!afs_suser(credp))
+    if (!afs_osi_suser(credp))
        return (EPERM);
 
     /** Code to convert a 32 bit dev_t into a 64 bit dev_t
@@ -254,7 +254,7 @@ afs_syscall_iopen(dev, inode, usrmod, rvp, credp)
 
     AFS_STATCNT(afs_syscall_iopen);
 
-    if (!afs_suser(credp))
+    if (!afs_osi_suser(credp))
        return (EPERM);
 
     /** Code to convert a 32 bit dev_t into a 64 bit dev_t
@@ -319,7 +319,7 @@ afs_syscall_iincdec(dev, inode, inode_p1, amount, rvp, credp)
     register afs_int32 code;
     dev_t newdev;
 
-    if (!afs_suser(credp))
+    if (!afs_osi_suser(credp))
        return (EPERM);
 
        /** Code to convert a 32 bit dev_t into a 64 bit dev_t
index eb94b2d..744dbab 100644 (file)
@@ -61,8 +61,10 @@ extern void *afs_osi_Alloc_NoSleep(size_t size);
   vn_rdwr((rw),(gp),(base),(len),(offset),(segflg),(ioflag),(ulimit),(cr),(aresid))
 
 
-#if !defined(AFS_SUN510_ENV)
-#define        afs_suser(x)        suser(x)
+#if defined(AFS_SUN510_ENV)
+#define afs_suser(x)        afs_osi_suser(x)
+#else
+#define afs_suser(x)        suser(x)
 #endif
 
 #ifdef KERNEL
index d253a38..e17d6d6 100644 (file)
@@ -43,15 +43,19 @@ afs_mount(struct vfs *afsp, struct vnode *amvp, struct mounta *uap,
 
     AFS_STATCNT(afs_mount);
 
-    if (!suser(credp)) {
+#if defined(AFS_SUN510_ENV)
+    if (secpolicy_fs_mount(credp, amvp, afsp) != 0) {
+#else
+    if (!afs_osi_suser(credp)) {
+#endif
        AFS_GUNLOCK();
-       return EPERM;
+       return (EPERM);
     }
     afsp->vfs_fstype = afsfstype;
 
     if (afs_globalVFS) {       /* Don't allow remounts. */
        AFS_GUNLOCK();
-       return EBUSY;
+       return (EBUSY);
     }
 
     afs_globalVFS = afsp;
@@ -75,9 +79,13 @@ afs_unmount(struct vfs *afsp, struct AFS_UCRED *credp)
     AFS_GLOCK();
     AFS_STATCNT(afs_unmount);
 
-    if (!suser(credp)) {
-       AFS_GUNLOCK();
-       return EPERM;
+#if defined(AFS_SUN510_ENV)
+    if (secpolicy_fs_unmount(credp, afsp) != 0) {
+#else
+    if (!afs_osi_suser(credp)) {
+#endif
+        AFS_GUNLOCK();
+        return (EPERM);
     }
     afs_globalVFS = 0;
     afs_shutdown();