diff options
author | 2003-01-23 23:15:16 +0000 | |
---|---|---|
committer | 2003-01-23 23:15:16 +0000 | |
commit | fd753520514ce2072136d92762b7f652f4c7f704 (patch) | |
tree | a59b4f9dd48284e83b2efde614098ed8c3a3ae79 | |
parent | - Either memset() or loop and set to zero, not both (diff) | |
download | wireguard-openbsd-fd753520514ce2072136d92762b7f652f4c7f704.tar.xz wireguard-openbsd-fd753520514ce2072136d92762b7f652f4c7f704.zip |
Honour TCP_WRAPPERS mk.conf setting; ok millert@
-rw-r--r-- | libexec/ftp-proxy/Makefile | 5 | ||||
-rw-r--r-- | libexec/ftp-proxy/ftp-proxy.c | 17 | ||||
-rw-r--r-- | libexec/ftp-proxy/util.c | 3 |
3 files changed, 19 insertions, 6 deletions
diff --git a/libexec/ftp-proxy/Makefile b/libexec/ftp-proxy/Makefile index 99a2b68d460..4a8855fb0ff 100644 --- a/libexec/ftp-proxy/Makefile +++ b/libexec/ftp-proxy/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.2 2002/05/23 10:22:14 deraadt Exp $ +# $OpenBSD: Makefile,v 1.3 2003/01/23 23:15:16 djm Exp $ # @(#)Makefile 8.2 (Berkeley) 4/4/94 PROG= ftp-proxy @@ -8,7 +8,10 @@ MAN= ftp-proxy.8 .include <bsd.own.mk> +.if (${TCP_WRAPPERS:L} == "yes") +CFLAGS+= -DLIBWRAP LDADD+= -lwrap DPADD+= ${LIBWRAP} +.endif .include <bsd.prog.mk> diff --git a/libexec/ftp-proxy/ftp-proxy.c b/libexec/ftp-proxy/ftp-proxy.c index 9762cf8d8e2..66522688f67 100644 --- a/libexec/ftp-proxy/ftp-proxy.c +++ b/libexec/ftp-proxy/ftp-proxy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp-proxy.c,v 1.27 2002/12/19 18:19:10 deraadt Exp $ */ +/* $OpenBSD: ftp-proxy.c,v 1.28 2003/01/23 23:15:16 djm Exp $ */ /* * Copyright (c) 1996-2001 @@ -88,13 +88,15 @@ #include <string.h> #include <sysexits.h> #include <syslog.h> -#include <tcpd.h> #include <unistd.h> #include "util.h" +#ifdef LIBWRAP +#include <tcpd.h> int allow_severity = LOG_INFO; int deny_severity = LOG_NOTICE; +#endif /* LIBWRAP */ int min_port = IPPORT_HIFIRSTAUTO; int max_port = IPPORT_HILASTAUTO; @@ -228,6 +230,7 @@ drop_privs(void) } } +#ifdef LIBWRAP /* * Check a connection against the tcpwrapper, log if we're going to * reject it, returns: 0 -> reject, 1 -> accept. We add in hostnames @@ -285,6 +288,7 @@ check_host(struct sockaddr_in *client_sin, struct sockaddr_in *server_sin) } return(1); } +#endif /* LIBWRAP */ double wallclock_time(void) @@ -958,9 +962,12 @@ main(int argc, char *argv[]) struct csiob client_iob, server_iob; struct sigaction new_sa, old_sa; int sval, ch, salen, flags, i; - int use_tcpwrapper = 0, one = 1; + int one = 1; long timeout_seconds = 0; struct timeval tv; +#ifdef LIBWRAP + int use_tcpwrapper = 0; +#endif /* LIBWRAP */ while ((ch = getopt(argc, argv, "D:g:m:M:t:u:AnVwr")) != -1) { char *p; @@ -1007,9 +1014,11 @@ main(int argc, char *argv[]) case 'V': Verbose = 1; break; +#ifdef LIBWRAP case 'w': use_tcpwrapper = 1; /* do the libwrap thing */ break; +#endif /* LIBWRAP */ default: usage(); /* NOTREACHED */ @@ -1071,8 +1080,10 @@ main(int argc, char *argv[]) exit(EX_OSERR); } +#ifdef LIBWRAP if (use_tcpwrapper && !check_host(&client_iob.sa, &real_server_sa)) exit(EX_NOPERM); +#endif client_iob.fd = 0; diff --git a/libexec/ftp-proxy/util.c b/libexec/ftp-proxy/util.c index 594ca063bac..c2bbab50e41 100644 --- a/libexec/ftp-proxy/util.c +++ b/libexec/ftp-proxy/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.13 2002/12/19 18:19:10 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.14 2003/01/23 23:15:16 djm Exp $ */ /* * Copyright (c) 1996-2001 @@ -53,7 +53,6 @@ #include <stdarg.h> #include <sysexits.h> #include <syslog.h> -#include <tcpd.h> #include <unistd.h> #include "util.h" |