From 75939147ff4e0a5d268bbc3b6a655453657b11b4 Mon Sep 17 00:00:00 2001 From: elad Date: Wed, 25 Oct 2006 12:48:44 +0000 Subject: [PATCH] Kill some KAUTH_GENERIC_ISSUSER. --- sys/netinet/in.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 0cdea613adc1..5ee8a7f4f5de 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $NetBSD: in.c,v 1.112 2006/10/12 01:32:37 christos Exp $ */ +/* $NetBSD: in.c,v 1.113 2006/10/25 12:48:44 elad Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.112 2006/10/12 01:32:37 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.113 2006/10/25 12:48:44 elad Exp $"); #include "opt_inet.h" #include "opt_inet_conf.h" @@ -321,8 +321,11 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, switch (cmd) { case SIOCALIFADDR: case SIOCDLIFADDR: - if (l == 0 || (error = kauth_authorize_generic(l->l_cred, - KAUTH_GENERIC_ISSUSER, &l->l_acflag))) + if (l == NULL) + return (EPERM); + if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE, + KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd, + NULL) != 0) return (EPERM); /*fall through*/ case SIOCGLIFADDR: @@ -377,8 +380,11 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, (cmd == SIOCSIFNETMASK || cmd == SIOCSIFDSTADDR)) return (EADDRNOTAVAIL); - if (l == 0 || (error = kauth_authorize_generic(l->l_cred, - KAUTH_GENERIC_ISSUSER, &l->l_acflag))) + if (l == NULL) + return (EPERM); + if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE, + KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd, + NULL) != 0) return (EPERM); if (ia == 0) { @@ -407,8 +413,11 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, break; case SIOCSIFBRDADDR: - if (l == 0 || (error = kauth_authorize_generic(l->l_cred, - KAUTH_GENERIC_ISSUSER, &l->l_acflag))) + if (l == NULL) + return (EPERM); + if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE, + KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd, + NULL) != 0) return (EPERM); /* FALLTHROUGH */