diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-13 22:37:01 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-13 22:37:01 +0000 |
commit | eb62cef5f54c964e42b875ce72a6806f338e25bd (patch) | |
tree | e24762e8a2e45cf6b45103c25fd083a9a2098906 /lib/libwrap | |
parent | 9ff4ffbde33a02a0606e7787e6ec202f9da3353f (diff) |
fix_options() is not used by anything; remove API, crank major
ok sthen
Diffstat (limited to 'lib/libwrap')
-rw-r--r-- | lib/libwrap/Makefile | 5 | ||||
-rw-r--r-- | lib/libwrap/fix_options.c | 100 | ||||
-rw-r--r-- | lib/libwrap/shlib_version | 2 |
3 files changed, 3 insertions, 104 deletions
diff --git a/lib/libwrap/Makefile b/lib/libwrap/Makefile index 448fbf1ad05..aa1ca5a263d 100644 --- a/lib/libwrap/Makefile +++ b/lib/libwrap/Makefile @@ -1,10 +1,9 @@ -# $OpenBSD: Makefile,v 1.7 2012/08/02 13:38:39 okan Exp $ +# $OpenBSD: Makefile,v 1.8 2013/11/13 22:37:00 deraadt Exp $ LIB= wrap SRCS= hosts_access.c options.c shell_cmd.c rfc931.c eval.c \ hosts_ctl.c refuse.c percent_x.c clean_exit.c \ - fix_options.c socket.c update.c misc.c \ - diag.c percent_m.c + socket.c update.c misc.c diag.c percent_m.c HDRS= tcpd.h # Configuration options for libwrap. diff --git a/lib/libwrap/fix_options.c b/lib/libwrap/fix_options.c deleted file mode 100644 index 8845b84d626..00000000000 --- a/lib/libwrap/fix_options.c +++ /dev/null @@ -1,100 +0,0 @@ -/* $OpenBSD: fix_options.c,v 1.8 2009/10/27 23:59:30 deraadt Exp $ */ - - /* - * Routine to disable IP-level socket options. This code was taken from 4.4BSD - * rlogind and kernel source, but all mistakes in it are my fault. - * - * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip_var.h> -#include <netinet/ip.h> -#include <netdb.h> -#include <stdio.h> -#include <syslog.h> - -#ifndef IPOPT_OPTVAL -#define IPOPT_OPTVAL 0 -#define IPOPT_OLEN 1 -#endif - -#include "tcpd.h" - -#define BUFFER_SIZE 512 /* Was: BUFSIZ */ - -/* fix_options - get rid of IP-level socket options */ - -void -fix_options(request) -struct request_info *request; -{ -#ifdef IP_OPTIONS - struct ipoption optbuf; - char lbuf[BUFFER_SIZE], *lp, *cp; - int ipproto; - socklen_t optsize = sizeof(optbuf); - size_t lps; - struct protoent *ip; - int fd = request->fd; - int i; - struct sockaddr_storage ss; - socklen_t sslen; - - /* - * check if this is AF_INET socket - * XXX IPv6 support? - */ - sslen = sizeof(ss); - if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) { - syslog(LOG_ERR, "getsockname: %m"); - clean_exit(request); - } - if (ss.ss_family != AF_INET) - return; - - if ((ip = getprotobyname("ip")) != 0) - ipproto = ip->p_proto; - else - ipproto = IPPROTO_IP; - - if (getsockopt(fd, ipproto, IP_OPTIONS, (char *) &optbuf, &optsize) == 0 - && optsize != 0) { - - /* - * Properly deal with source routing entries. The original code - * here was wrong. - */ - for (i = 0; (void *)&optbuf.ipopt_list[i] - (void *)&optbuf < - optsize; ) { - u_char c = (u_char)optbuf.ipopt_list[i]; - if (c == IPOPT_LSRR || c == IPOPT_SSRR) { - syslog(LOG_WARNING, - "refused connect from %s with IP source routing options", - eval_client(request)); - clean_exit(request); - } - if (c == IPOPT_EOL) - break; - i += (c == IPOPT_NOP) ? 1 : (u_char)optbuf.ipopt_list[i+1]; - } - - lp = lbuf; - lps = sizeof(lbuf); - for (cp = (char *)&optbuf; optsize > 0 && lps > 0; - cp++, optsize--, lp += 3, lps -= 3) - snprintf(lp, lps, " %2.2x", *cp); - syslog(LOG_NOTICE, - "connect from %s with IP options (ignored):%s", - eval_client(request), lbuf); - if (setsockopt(fd, ipproto, IP_OPTIONS, (char *) 0, optsize) != 0) { - syslog(LOG_ERR, "setsockopt IP_OPTIONS NULL: %m"); - clean_exit(request); - } - } -#endif -} diff --git a/lib/libwrap/shlib_version b/lib/libwrap/shlib_version index 3066b9771e7..9c1551636c5 100644 --- a/lib/libwrap/shlib_version +++ b/lib/libwrap/shlib_version @@ -1,2 +1,2 @@ -major=5 +major=6 minor=0 |