summaryrefslogtreecommitdiffstats
path: root/sys/netipx
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2008-09-17 15:49:44 +0000
committerattilio <attilio@FreeBSD.org>2008-09-17 15:49:44 +0000
commit23ff3dbeb88f559906401e0fc17cf66554a620ab (patch)
treecf10ffc60d6ce4ed9af75e25eb64a81244564299 /sys/netipx
parent30605e1eb117a4e8f8f43b22d297ee4594992fde (diff)
downloadFreeBSD-src-23ff3dbeb88f559906401e0fc17cf66554a620ab.zip
FreeBSD-src-23ff3dbeb88f559906401e0fc17cf66554a620ab.tar.gz
Remove the suser(9) interface from the kernel. It has been replaced from
years by the priv_check(9) interface and just very few places are left. Note that compatibility stub with older FreeBSD version (all above the 8 limit though) are left in order to reduce diffs against old versions. It is responsibility of the maintainers for any module, if they think it is the case, to axe out such cases. This patch breaks KPI so __FreeBSD_version will be bumped into a later commit. This patch needs to be credited 50-50 with rwatson@ as he found time to explain me how the priv_check() works in detail and to review patches. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com> Reviewed by: rwatson
Diffstat (limited to 'sys/netipx')
-rw-r--r--sys/netipx/ipx.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c
index 5ae0d4b..5761636 100644
--- a/sys/netipx/ipx.c
+++ b/sys/netipx/ipx.c
@@ -99,7 +99,7 @@ ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
struct ifaddr *ifa;
struct ipx_ifaddr *oia;
int dstIsNew, hostIsNew;
- int error = 0;
+ int error = 0, priv;
/*
* Find address for this interface, if it exists.
@@ -135,12 +135,13 @@ ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
return (0);
}
- if (td && (error = suser(td)) != 0)
- return (error);
-
switch (cmd) {
case SIOCAIFADDR:
case SIOCDIFADDR:
+ priv = (cmd == SIOCAIFADDR) ? PRIV_NET_ADDIFADDR :
+ PRIV_NET_DELIFADDR;
+ if (td && (error = priv_check(td, priv)) != 0)
+ return (error);
if (ifra->ifra_addr.sipx_family == AF_IPX)
for (oia = ia; ia != NULL; ia = ia->ia_next) {
if (ia->ia_ifp == ifp &&
@@ -154,6 +155,8 @@ ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
case SIOCSIFADDR:
case SIOCSIFDSTADDR:
+ if (td && (error = priv_check(td, PRIV_NET_SETLLADDR)) != 0)
+ return (error);
if (ia == NULL) {
oia = (struct ipx_ifaddr *)
malloc(sizeof(*ia), M_IFADDR,
@@ -183,6 +186,10 @@ ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
ia->ia_broadaddr.sipx_addr.x_host = ipx_broadhost;
}
}
+ break;
+ default:
+ if (td && (error = priv_check(td, PRIV_NET_HWIOCTL)) != 0)
+ return (error);
}
switch (cmd) {
OpenPOWER on IntegriCloud