diff options
author | ru <ru@FreeBSD.org> | 2001-08-31 12:31:09 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-08-31 12:31:09 +0000 |
commit | 3be01aaf661cb34c3b44d7a7d7ff9639b3f2fda8 (patch) | |
tree | cdab053999aa91e5d1a8cb485dbfb2159ac249f2 /sys/net/rtsock.c | |
parent | 4006cfa6ed3e7697bcadb070b91c135dd6ca56f7 (diff) | |
download | FreeBSD-src-3be01aaf661cb34c3b44d7a7d7ff9639b3f2fda8.zip FreeBSD-src-3be01aaf661cb34c3b44d7a7d7ff9639b3f2fda8.tar.gz |
Synch with NetBSD and OpenBSD.
Allow non-superuser to open, listen to, and send safe commands on the
routing socket. Superuser priviledge is required for all commands
but RTM_GET.
Lose `setuid root' bit of route(8).
Reviewed by: wollman, dd
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index e8e85eb..ede7ad6 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -123,7 +123,7 @@ rts_attach(struct socket *so, int proto, struct proc *p) */ s = splnet(); so->so_pcb = (caddr_t)rp; - error = raw_usrreqs.pru_attach(so, proto, p); + error = raw_attach(so, proto); rp = sotorawcb(so); if (error) { splx(s); @@ -326,6 +326,14 @@ route_output(m, so) else senderr(ENOBUFS); } + + /* + * Verify that the caller has the appropriate privilege; RTM_GET + * is the only operation the non-superuser is allowed. + */ + if (rtm->rtm_type != RTM_GET && suser_xxx(so->so_cred, NULL, 0) != 0) + senderr(EPERM); + switch (rtm->rtm_type) { case RTM_ADD: |