summaryrefslogtreecommitdiffstats
path: root/sys/netinet/in_pcb.c
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/netinet/in_pcb.c
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/netinet/in_pcb.c')
-rw-r--r--sys/netinet/in_pcb.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 7631c44..be95188 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -178,7 +178,6 @@ in_pcbbind(inp, nam, td)
struct sockaddr *nam;
struct thread *td;
{
- struct proc *p = td->td_proc;
register struct socket *so = inp->inp_socket;
unsigned short *lastport;
struct sockaddr_in *sin;
@@ -228,8 +227,8 @@ in_pcbbind(inp, nam, td)
if (lport) {
struct inpcb *t;
/* GROSS */
- if (ntohs(lport) < IPPORT_RESERVED && p &&
- suser_xxx(0, p, PRISON_ROOT))
+ if (ntohs(lport) < IPPORT_RESERVED && td &&
+ suser_cred(td->td_ucred, PRISON_ROOT))
return (EACCES);
if (td && jailed(td->td_ucred))
prison = 1;
@@ -292,7 +291,7 @@ in_pcbbind(inp, nam, td)
last = ipport_hilastauto;
lastport = &pcbinfo->lasthi;
} else if (inp->inp_flags & INP_LOWPORT) {
- if (p && (error = suser_xxx(0, p, PRISON_ROOT))) {
+ if (td && (error = suser_cred(td->td_ucred, PRISON_ROOT))) {
inp->inp_laddr.s_addr = INADDR_ANY;
return error;
}
OpenPOWER on IntegriCloud