From ca2bdb05a955957ea14767e4f8c5f35d7c4f0163 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 7 Feb 1997 06:27:19 +0000 Subject: [PATCH] destroy everything with source routes --- lib/libc/rpc/svc_tcp.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index e9bf8d440b0..0fac0993df6 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.7 1996/08/20 23:47:46 deraadt Exp $"; +static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.8 1997/02/07 06:27:19 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -49,6 +49,10 @@ static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.7 1996/08/20 23:47:46 deraadt Exp #include #include +#include +#include +#include + /* * Ops vector for TCP/IP based rpc service handle */ @@ -241,6 +245,28 @@ rendezvous_request(xprt) goto again; return (FALSE); } + +#ifdef IP_OPTIONS + { + u_char optbuf[BUFSIZ/3]; + int optsize = sizeof(optbuf), i; + + if (!getsockopt(sock, IPPROTO_IP, IP_OPTIONS, (char *)optbuf, + &optsize) && optsize != 0) { + for (i = 0; i < optsize; ) { + u_char c = optbuf[i]; + if (c == IPOPT_LSRR || c == IPOPT_SSRR) { + close(sock); + goto again; + } + if (c == IPOPT_EOL) + break; + i += (c == IPOPT_NOP) ? 1 : optbuf[i+1]; + } + } + } +#endif + /* * XXX careful for ftp bounce attacks. If discovered, close the * socket and look for another connection. @@ -249,6 +275,7 @@ rendezvous_request(xprt) close(sock); goto again; } + /* * make a new transporter (re-uses xprt) */ -- 2.20.1