Source-Changes-HG archive

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

[src/trunk]: src/sys/net Oops, restrict SIOCIF{CREATE, DESTROY} to super-user.



details:   https://anonhg.NetBSD.org/src/rev/9c7108e47886
branches:  trunk
changeset: 494219:9c7108e47886
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jul 04 01:51:22 2000 +0000

description:
Oops, restrict SIOCIF{CREATE,DESTROY} to super-user.

diffstat:

 sys/net/if.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 7c5d1fb18325 -r 9c7108e47886 sys/net/if.c
--- a/sys/net/if.c      Tue Jul 04 01:29:14 2000 +0000
+++ b/sys/net/if.c      Tue Jul 04 01:51:22 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.63 2000/07/02 00:20:48 thorpej Exp $  */
+/*     $NetBSD: if.c,v 1.64 2000/07/04 01:51:22 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -973,9 +973,12 @@
 
        switch (cmd) {
        case SIOCIFCREATE:
-               return (if_clone_create(ifr->ifr_name));
        case SIOCIFDESTROY:
-               return (if_clone_destroy(ifr->ifr_name));
+               if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
+                       return (error);
+               return ((cmd == SIOCIFCREATE) ?
+                       if_clone_create(ifr->ifr_name) :
+                       if_clone_destroy(ifr->ifr_name));
        }
 
        ifp = ifunit(ifr->ifr_name);



Home | Main Index | Thread Index | Old Index