From 44731cab3b9966b7ca67f3fe50e7f3c711533730 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 1 Apr 2002 21:31:13 +0000 Subject: Change the suser() API to take advantage of td_ucred as well as do a general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ --- sys/dev/awi/awi.c | 16 ++++++++++++++++ sys/dev/awi/awi_wep.c | 4 ++++ sys/dev/awi/awi_wicfg.c | 8 ++++++++ 3 files changed, 28 insertions(+) (limited to 'sys/dev/awi') diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c index fe764b04e439..6dfde41e4d25 100644 --- a/sys/dev/awi/awi.c +++ b/sys/dev/awi/awi.c @@ -521,7 +521,11 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWID: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if (error) break; #endif @@ -555,7 +559,11 @@ awi_ioctl(ifp, cmd, data) break; case SIOCS80211NWKEY: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if (error) break; #endif @@ -613,7 +621,11 @@ awi_ioctl(ifp, cmd, data) error = awi_wep_getkey(sc, ireq->i_val, tmpstr, &len); if(error) break; +#if __FreeBSD__ >= 5 + if(!suser(curthread)) +#else if(!suser(curproc)) +#endif bzero(tmpstr, len); ireq->i_len = len; error = copyout(tmpstr, ireq->i_data, len); @@ -650,7 +662,11 @@ awi_ioctl(ifp, cmd, data) } break; case SIOCS80211: +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif if(error) break; switch(ireq->i_type) { diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c index 750b165d2e2d..bdd38b296dfe 100644 --- a/sys/dev/awi/awi_wep.c +++ b/sys/dev/awi/awi_wep.c @@ -189,7 +189,11 @@ awi_wep_getnwkey(sc, nwkey) nwkey->i_defkid = sc->sc_wep_defkid + 1; /* do not show any keys to non-root user */ #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + suerr = suser(curthread); +#else suerr = suser(curproc); +#endif #else suerr = suser(curproc->p_ucred, &curproc->p_acflag); #endif diff --git a/sys/dev/awi/awi_wicfg.c b/sys/dev/awi/awi_wicfg.c index 80b81600fedd..639ea9bfe318 100644 --- a/sys/dev/awi/awi_wicfg.c +++ b/sys/dev/awi/awi_wicfg.c @@ -108,7 +108,11 @@ awi_wicfg(ifp, cmd, data) break; case SIOCSWAVELAN: #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif @@ -272,7 +276,11 @@ awi_cfgget(ifp, cmd, data) keys = (struct wi_ltv_keys *)&wreq; /* do not show keys to non-root user */ #ifdef __FreeBSD__ +#if __FreeBSD__ >= 5 + error = suser(curthread); +#else error = suser(curproc); +#endif #else error = suser(curproc->p_ucred, &curproc->p_acflag); #endif -- cgit v1.3