summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2002-08-12 01:16:55 +0000
committerrwatson <rwatson@FreeBSD.org>2002-08-12 01:16:55 +0000
commit97ad1768f7183226cbe25a8f99219ef3cc582de9 (patch)
treeab2cd59c018c334aec042c20cd70fc67a72d2ec7 /sys/alpha
parentd8202a09a49f5fa629402a69d87030f38a6a6ccb (diff)
downloadFreeBSD-src-97ad1768f7183226cbe25a8f99219ef3cc582de9.zip
FreeBSD-src-97ad1768f7183226cbe25a8f99219ef3cc582de9.tar.gz
Teach the OSF/1 emulation layer a little more about mandatory access
control: perform checks during OSF/1 statfs()-related calls by invoking mac_check_mount_stat(). Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/osf1/osf1_mount.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/alpha/osf1/osf1_mount.c b/sys/alpha/osf1/osf1_mount.c
index faa9178..0a1347a 100644
--- a/sys/alpha/osf1/osf1_mount.c
+++ b/sys/alpha/osf1/osf1_mount.c
@@ -32,6 +32,7 @@
* $FreeBSD$
*/
+#include "opt_mac.h"
#include "opt_nfs.h"
#include <sys/param.h>
@@ -42,6 +43,7 @@
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/vnode.h>
+#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/proc.h>
@@ -131,6 +133,11 @@ osf1_statfs(td, uap)
mp = nd.ni_vp->v_mount;
sp = &mp->mnt_stat;
vrele(nd.ni_vp);
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error)
+ return (error);
+#endif
if ((error = VFS_STATFS(mp, sp, td)))
return (error);
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
@@ -153,6 +160,13 @@ osf1_fstatfs(td, uap)
if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)))
return (error);
mp = ((struct vnode *)fp->f_data)->v_mount;
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error) {
+ fdrop(fp, td);
+ return (error);
+ }
+#endif
sp = &mp->mnt_stat;
error = VFS_STATFS(mp, sp, td);
fdrop(fp, td);
@@ -183,6 +197,11 @@ osf1_getfsstat(td, uap)
for (count = 0, mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
nmp = TAILQ_NEXT(mp, mnt_list);
if (osf_sfsp && count < maxcount) {
+#ifdef MAC
+ error = mac_check_mount_stat(td->td_proc->p_ucred, mp);
+ if (error)
+ continue;
+#endif
sp = &mp->mnt_stat;
/*
* If OSF1_MNT_NOWAIT is specified, do not refresh the
OpenPOWER on IntegriCloud