summaryrefslogtreecommitdiffstats
path: root/sys/dev/awi
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
committerjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
commitdc2e474f79c1287592679cd5e0c4c2307feccd60 (patch)
tree79021f0d43a5858be317d5cd33eac8cd4962b336 /sys/dev/awi
parent34c7d606c9818987384d404948ecdc98521462bd (diff)
downloadFreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.zip
FreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.tar.gz
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@
Diffstat (limited to 'sys/dev/awi')
-rw-r--r--sys/dev/awi/awi.c16
-rw-r--r--sys/dev/awi/awi_wep.c4
-rw-r--r--sys/dev/awi/awi_wicfg.c8
3 files changed, 28 insertions, 0 deletions
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index fe764b0..6dfde41 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 750b165..bdd38b2 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 80b8160..639ea9b 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
OpenPOWER on IntegriCloud