From 71f6f346caa9f501a0b7af23c9d4425d9357f3eb Mon Sep 17 00:00:00 2001 From: Dale Ghent Date: Tue, 2 Jan 2007 07:33:23 +0000 Subject: [PATCH] solaris10-suser-replace-20070102 FIXES 50246 suser is dead, long live suser --- src/afs/SOLARIS/osi_inode.c | 6 +++--- src/afs/SOLARIS/osi_machdep.h | 6 ++++-- src/afs/SOLARIS/osi_vfsops.c | 20 ++++++++++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/afs/SOLARIS/osi_inode.c b/src/afs/SOLARIS/osi_inode.c index 5e0d5813f..d352e32ab 100644 --- a/src/afs/SOLARIS/osi_inode.c +++ b/src/afs/SOLARIS/osi_inode.c @@ -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 diff --git a/src/afs/SOLARIS/osi_machdep.h b/src/afs/SOLARIS/osi_machdep.h index eb94b2d7c..744dbab0b 100644 --- a/src/afs/SOLARIS/osi_machdep.h +++ b/src/afs/SOLARIS/osi_machdep.h @@ -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 diff --git a/src/afs/SOLARIS/osi_vfsops.c b/src/afs/SOLARIS/osi_vfsops.c index d253a38d6..e17d6d6c5 100644 --- a/src/afs/SOLARIS/osi_vfsops.c +++ b/src/afs/SOLARIS/osi_vfsops.c @@ -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(); -- 2.39.5