Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Introduce a sysctl to enable/disable if non-root us...



details:   https://anonhg.NetBSD.org/src/rev/5e2b5579c274
branches:  trunk
changeset: 482601:5e2b5579c274
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Wed Feb 16 11:57:45 2000 +0000

description:
Introduce a sysctl to enable/disable if non-root users can mount filesystems.
Default: off.

diffstat:

 sys/kern/vfs_subr.c     |  6 +++++-
 sys/kern/vfs_syscalls.c |  6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r fb686cc3038e -r 5e2b5579c274 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Wed Feb 16 11:57:00 2000 +0000
+++ b/sys/kern/vfs_subr.c       Wed Feb 16 11:57:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.116 1999/12/15 07:10:32 perseant Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.117 2000/02/16 11:57:45 fvdl Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -124,6 +124,8 @@
 int doforce = 1;               /* 1 => permit forcible unmounting */
 int prtactive = 0;             /* 1 => print out reclaim of active vnodes */
 
+extern int dovfsusermount;     /* 1 => permit any user to mount filesystems */
+
 /*
  * Insq/Remq for the vnode usage lists.
  */
@@ -1753,6 +1755,8 @@
 
        /* The rest are generic vfs sysctls. */
        switch (name[1]) {
+       case VFS_USERMOUNT:
+               return sysctl_int(oldp, oldlenp, newp, newlen, &dovfsusermount);
 #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
        case VFS_MAXTYPENUM:
                /*
diff -r fb686cc3038e -r 5e2b5579c274 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Wed Feb 16 11:57:00 2000 +0000
+++ b/sys/kern/vfs_syscalls.c   Wed Feb 16 11:57:45 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.149 2000/02/01 01:24:38 assar Exp $ */
+/*     $NetBSD: vfs_syscalls.c,v 1.150 2000/02/16 11:57:46 fvdl Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -78,6 +78,8 @@
 void checkdirs __P((struct vnode *));
 int dounmount __P((struct mount *, int, struct proc *));
 
+int dovfsusermount = 0;
+
 /*
  * Virtual File System System Calls
  */
@@ -140,6 +142,8 @@
        struct nameidata nd;
        struct vfsops *vfs;
 
+       if (dovfsusermount == 0 && (error = suser(p->p_ucred, &p->p_acflag)))
+               return (error);
        /*
         * Get vnode to be covered
         */



Home | Main Index | Thread Index | Old Index