diff options
author | kato <kato@FreeBSD.org> | 1997-10-23 09:29:09 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1997-10-23 09:29:09 +0000 |
commit | e4e4abd8bfb43d9c401aaee163ac5edebd16251b (patch) | |
tree | 03b9088e90cfc543269aa0859e7f392e5dd0202a /sys/kern | |
parent | 04b14b1941596eb4f011900f3223a9697009e169 (diff) | |
download | FreeBSD-src-e4e4abd8bfb43d9c401aaee163ac5edebd16251b.zip FreeBSD-src-e4e4abd8bfb43d9c401aaee163ac5edebd16251b.tar.gz |
Disallow non-root mount. If you want to allow non-root mount, change
vfs.usermount into 1 with sysctl.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_extattr.c | 9 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 057e908..cafe82d 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.76 1997/10/12 20:24:27 phk Exp $ + * $Id: vfs_syscalls.c,v 1.77 1997/10/22 07:28:51 joerg Exp $ */ /* @@ -77,6 +77,10 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); static void checkdirs __P((struct vnode *olddp)); +static int usermount = 0; /* if 1, non-root can mount fs. */ + +SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, ""); + /* * Virtual File System System Calls */ @@ -113,6 +117,9 @@ mount(p, uap, retval) struct nameidata nd; char fstypename[MFSNAMELEN]; + if (usermount == 0 && (error = suser(p->p_ucred, &p->p_acflag))) + return (error); + /* * Get vnode to be covered */ diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 057e908..cafe82d 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.76 1997/10/12 20:24:27 phk Exp $ + * $Id: vfs_syscalls.c,v 1.77 1997/10/22 07:28:51 joerg Exp $ */ /* @@ -77,6 +77,10 @@ static int change_dir __P((struct nameidata *ndp, struct proc *p)); static void checkdirs __P((struct vnode *olddp)); +static int usermount = 0; /* if 1, non-root can mount fs. */ + +SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, ""); + /* * Virtual File System System Calls */ @@ -113,6 +117,9 @@ mount(p, uap, retval) struct nameidata nd; char fstypename[MFSNAMELEN]; + if (usermount == 0 && (error = suser(p->p_ucred, &p->p_acflag))) + return (error); + /* * Get vnode to be covered */ |