diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2006-11-06 14:54:06 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2006-11-06 14:54:06 +0000 |
| commit | b96fbb37dac58069c6e1e777355a1afc8a6b491e (patch) | |
| tree | 24a5a8ca0f6495fc45fd07f1b990052667d646a6 /sys | |
| parent | f4ad963c9fccd81cd7c47e8f3ba49ae06c5f95bc (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netinet/sctp_pcb.c | 6 | ||||
| -rw-r--r-- | sys/netinet/sctp_usrreq.c | 9 | ||||
| -rw-r--r-- | sys/netinet6/sctp6_usrreq.c | 9 |
3 files changed, 19 insertions, 5 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index d00e8604bc16..24c2ba5ed0fe 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <sys/protosw.h> #include <sys/socket.h> #include <sys/socketvar.h> +#include <sys/priv.h> #include <sys/proc.h> #include <sys/kernel.h> #include <sys/sysctl.h> @@ -1768,9 +1769,8 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, struct thread *p) */ /* got to be root to get at low ports */ if (ntohs(lport) < IPPORT_RESERVED) { - if (p && (error = - suser_cred(p->td_ucred, 0) - )) { + if (p && (error = priv_check(p, + PRIV_NETINET_RESERVEDPORT))) { SCTP_INP_DECR_REF(inp); SCTP_INP_WUNLOCK(inp); SCTP_INP_INFO_WUNLOCK(); diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 63097a84e90e..25d639f678c8 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/domain.h> +#include <sys/priv.h> #include <sys/proc.h> #include <sys/protosw.h> #include <sys/socket.h> @@ -488,9 +489,15 @@ sctp_getcred(SYSCTL_HANDLER_ARGS) struct sctp_tcb *stcb; int error, s; - error = suser(req->td); + /* + * XXXRW: Other instances of getcred use SUSER_ALLOWJAIL, as socket + * visibility is scoped using cr_canseesocket(), which it is not + * here. + */ + error = priv_check_cred(req->td->td_ucred, PRIV_NETINET_GETCRED, 0); if (error) return (error); + error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); diff --git a/sys/netinet6/sctp6_usrreq.c b/sys/netinet6/sctp6_usrreq.c index 39d531b82ce9..34836587705b 100644 --- a/sys/netinet6/sctp6_usrreq.c +++ b/sys/netinet6/sctp6_usrreq.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <sys/systm.h> #include <sys/syslog.h> +#include <sys/priv.h> #include <sys/proc.h> #include <net/if.h> #include <net/route.h> @@ -481,7 +482,13 @@ sctp6_getcred(SYSCTL_HANDLER_ARGS) struct sctp_tcb *stcb; int error, s; - error = suser(req->td); + /* + * XXXRW: Other instances of getcred use SUSER_ALLOWJAIL, as socket + * visibility is scoped using cr_canseesocket(), which it is not + * here. + */ + error = priv_check_cred(req->td->td_ucred, PRIV_NETINET_RESERVEDPORT, + 0); if (error) return (error); |
