summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-12-28 14:16:02 +0100
committerMax Kellermann <max@musicpd.org>2018-12-28 14:16:02 +0100
commit22e6d95c4bbae15dd7f635eabe5fdde1ce06ba73 (patch)
tree30015237746efc3de22232ac012c2acf57ece4fb
parent1c7bd7d5c4ff7afaecf4a68978ae53e9d2094026 (diff)
remove libwrap support
libwrap is an obscure artefact from a past long ago, when source IP address meant something. And its API is "interesting"; it requires the application to expose two global variables `allow_severity` and `deny_severity`. This led to bug #437. I don't want to declare those variables; instead, I'd like to remove libwrap support. Closes #437
-rw-r--r--NEWS1
-rw-r--r--doc/user.rst2
-rw-r--r--meson.build2
-rw-r--r--meson_options.txt1
-rw-r--r--src/client/ClientNew.cxx25
-rw-r--r--src/lib/wrap/meson.build21
-rw-r--r--src/output/plugins/httpd/HttpdOutputPlugin.cxx30
-rw-r--r--src/output/plugins/meson.build2
8 files changed, 4 insertions, 80 deletions
diff --git a/NEWS b/NEWS
index 5a3da39db..5fb59a9bb 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ ver 0.21.4 (not yet released)
- upnp: implement "list ... group"
* output
- httpd: declare protocol "HTTP/1.1" instead of "ICY"
+* remove libwrap support
ver 0.21.3 (2018/11/16)
* output
diff --git a/doc/user.rst b/doc/user.rst
index 9dbe03b1d..b16956fc3 100644
--- a/doc/user.rst
+++ b/doc/user.rst
@@ -88,7 +88,7 @@ For example, the following installs a fairly complete list of build dependencies
libupnp-dev \
libavahi-client-dev \
libsqlite3-dev \
- libsystemd-dev libwrap0-dev \
+ libsystemd-dev \
libgtest-dev \
libboost-dev \
libicu-dev
diff --git a/meson.build b/meson.build
index 58e979a39..a836eb2d2 100644
--- a/meson.build
+++ b/meson.build
@@ -312,7 +312,6 @@ subdir('src/lib/curl')
subdir('src/lib/expat')
subdir('src/lib/ffmpeg')
subdir('src/lib/gcrypt')
-subdir('src/lib/wrap')
subdir('src/lib/nfs')
subdir('src/lib/oss')
subdir('src/lib/pcre')
@@ -432,7 +431,6 @@ mpd = build_target(
systemd_dep,
sqlite_dep,
zeroconf_dep,
- libwrap_dep,
more_deps,
],
link_args: link_args,
diff --git a/meson_options.txt b/meson_options.txt
index 9a31e548e..d6bd91ee6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -175,7 +175,6 @@ option('dbus', type: 'feature', description: 'D-Bus support')
option('expat', type: 'feature', description: 'Expat XML support')
option('icu', type: 'feature', description: 'Use libicu for Unicode')
option('iconv', type: 'feature', description: 'Use iconv() for character set conversion')
-option('libwrap', type: 'feature', description: 'libwrap support')
option('pcre', type: 'feature', description: 'Enable regular expression support (using libpcre)')
option('sqlite', type: 'feature', description: 'SQLite database support (for stickers)')
option('yajl', type: 'feature', description: 'libyajl for YAML support')
diff --git a/src/client/ClientNew.cxx b/src/client/ClientNew.cxx
index d7fab2a9c..85ce97aa3 100644
--- a/src/client/ClientNew.cxx
+++ b/src/client/ClientNew.cxx
@@ -35,10 +35,6 @@
#include <sys/socket.h>
#endif
-#ifdef HAVE_LIBWRAP
-#include <tcpd.h>
-#endif
-
static constexpr char GREETING[] = "OK MPD " PROTOCOL_VERSION "\n";
Client::Client(EventLoop &_loop, Partition &_partition,
@@ -66,27 +62,6 @@ client_new(EventLoop &loop, Partition &partition,
assert(fd.IsDefined());
-#ifdef HAVE_LIBWRAP
- if (address.GetFamily() != AF_LOCAL) {
- // TODO: shall we obtain the program name from argv[0]?
- const char *progname = "mpd";
-
- struct request_info req;
- request_init(&req, RQ_FILE, fd.Get(), RQ_DAEMON, progname, 0);
-
- fromhost(&req);
-
- if (!hosts_access(&req)) {
- /* tcp wrappers says no */
- FormatWarning(client_domain,
- "libwrap refused connection (libwrap=%s) from %s",
- progname, remote.c_str());
-
- return;
- }
- }
-#endif /* HAVE_WRAP */
-
ClientList &client_list = *partition.instance.client_list;
if (client_list.IsFull()) {
LogWarning(client_domain, "Max connections reached");
diff --git a/src/lib/wrap/meson.build b/src/lib/wrap/meson.build
deleted file mode 100644
index bd0461608..000000000
--- a/src/lib/wrap/meson.build
+++ /dev/null
@@ -1,21 +0,0 @@
-libwrap_option = get_option('libwrap')
-enable_libwrap = false
-if not libwrap_option.disabled() and compiler.has_header('tcpd.h') and compiler.compiles('''
-#include <tcpd.h>
-bool CheckLibWrap(int fd, const char &progname) {
- struct request_info req;
- request_init(&req, RQ_FILE, fd, RQ_DAEMON, progname, 0);
- fromhost(&req);
- return hosts_access(&req);
-}
-''')
- libwrap_dep = compiler.find_library('wrap', required: libwrap_option)
-else
- libwrap_dep = dependency('', required: libwrap_option)
-endif
-
-if not libwrap_dep.found() and libwrap_option.enabled()
- error('libwrap not found')
-endif
-
-conf.set('HAVE_LIBWRAP', libwrap_dep.found())
diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
index 37062f7dd..1c6ad849d 100644
--- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx
+++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx
@@ -40,11 +40,6 @@
#include <string.h>
#include <errno.h>
-#ifdef HAVE_LIBWRAP
-#include <sys/socket.h> /* needed for AF_LOCAL */
-#include <tcpd.h>
-#endif
-
const Domain httpd_output_domain("httpd_output");
inline
@@ -130,34 +125,11 @@ HttpdOutput::OnDeferredBroadcast() noexcept
void
HttpdOutput::OnAccept(UniqueSocketDescriptor fd,
- SocketAddress address, gcc_unused int uid) noexcept
+ SocketAddress, gcc_unused int uid) noexcept
{
/* the listener socket has become readable - a client has
connected */
-#ifdef HAVE_LIBWRAP
- if (address.GetFamily() != AF_LOCAL) {
- const auto hostaddr = ToString(address);
- // TODO: shall we obtain the program name from argv[0]?
- const char *progname = "mpd";
-
- struct request_info req;
- request_init(&req, RQ_FILE, fd.Get(), RQ_DAEMON, progname, 0);
-
- fromhost(&req);
-
- if (!hosts_access(&req)) {
- /* tcp wrappers says no */
- FormatWarning(httpd_output_domain,
- "libwrap refused connection (libwrap=%s) from %s",
- progname, hostaddr.c_str());
- return;
- }
- }
-#else
- (void)address;
-#endif /* HAVE_WRAP */
-
const std::lock_guard<Mutex> protect(mutex);
/* can we allow additional client */
diff --git a/src/output/plugins/meson.build b/src/output/plugins/meson.build
index 7b5ea8bb8..65883323b 100644
--- a/src/output/plugins/meson.build
+++ b/src/output/plugins/meson.build
@@ -38,7 +38,7 @@ if get_option('httpd')
'httpd/HttpdClient.cxx',
'httpd/HttpdOutputPlugin.cxx',
]
- output_plugins_deps += [ event_dep, net_dep, libwrap_dep ]
+ output_plugins_deps += [ event_dep, net_dep ]
need_encoder = true
endif