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
This commit is contained in:
parent
1c7bd7d5c4
commit
22e6d95c4b
1
NEWS
1
NEWS
|
@ -4,6 +4,7 @@ ver 0.21.4 (not yet released)
|
||||||
- upnp: implement "list ... group"
|
- upnp: implement "list ... group"
|
||||||
* output
|
* output
|
||||||
- httpd: declare protocol "HTTP/1.1" instead of "ICY"
|
- httpd: declare protocol "HTTP/1.1" instead of "ICY"
|
||||||
|
* remove libwrap support
|
||||||
|
|
||||||
ver 0.21.3 (2018/11/16)
|
ver 0.21.3 (2018/11/16)
|
||||||
* output
|
* output
|
||||||
|
|
|
@ -88,7 +88,7 @@ For example, the following installs a fairly complete list of build dependencies
|
||||||
libupnp-dev \
|
libupnp-dev \
|
||||||
libavahi-client-dev \
|
libavahi-client-dev \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
libsystemd-dev libwrap0-dev \
|
libsystemd-dev \
|
||||||
libgtest-dev \
|
libgtest-dev \
|
||||||
libboost-dev \
|
libboost-dev \
|
||||||
libicu-dev
|
libicu-dev
|
||||||
|
|
|
@ -312,7 +312,6 @@ subdir('src/lib/curl')
|
||||||
subdir('src/lib/expat')
|
subdir('src/lib/expat')
|
||||||
subdir('src/lib/ffmpeg')
|
subdir('src/lib/ffmpeg')
|
||||||
subdir('src/lib/gcrypt')
|
subdir('src/lib/gcrypt')
|
||||||
subdir('src/lib/wrap')
|
|
||||||
subdir('src/lib/nfs')
|
subdir('src/lib/nfs')
|
||||||
subdir('src/lib/oss')
|
subdir('src/lib/oss')
|
||||||
subdir('src/lib/pcre')
|
subdir('src/lib/pcre')
|
||||||
|
@ -432,7 +431,6 @@ mpd = build_target(
|
||||||
systemd_dep,
|
systemd_dep,
|
||||||
sqlite_dep,
|
sqlite_dep,
|
||||||
zeroconf_dep,
|
zeroconf_dep,
|
||||||
libwrap_dep,
|
|
||||||
more_deps,
|
more_deps,
|
||||||
],
|
],
|
||||||
link_args: link_args,
|
link_args: link_args,
|
||||||
|
|
|
@ -175,7 +175,6 @@ option('dbus', type: 'feature', description: 'D-Bus support')
|
||||||
option('expat', type: 'feature', description: 'Expat XML support')
|
option('expat', type: 'feature', description: 'Expat XML support')
|
||||||
option('icu', type: 'feature', description: 'Use libicu for Unicode')
|
option('icu', type: 'feature', description: 'Use libicu for Unicode')
|
||||||
option('iconv', type: 'feature', description: 'Use iconv() for character set conversion')
|
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('pcre', type: 'feature', description: 'Enable regular expression support (using libpcre)')
|
||||||
option('sqlite', type: 'feature', description: 'SQLite database support (for stickers)')
|
option('sqlite', type: 'feature', description: 'SQLite database support (for stickers)')
|
||||||
option('yajl', type: 'feature', description: 'libyajl for YAML support')
|
option('yajl', type: 'feature', description: 'libyajl for YAML support')
|
||||||
|
|
|
@ -35,10 +35,6 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBWRAP
|
|
||||||
#include <tcpd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static constexpr char GREETING[] = "OK MPD " PROTOCOL_VERSION "\n";
|
static constexpr char GREETING[] = "OK MPD " PROTOCOL_VERSION "\n";
|
||||||
|
|
||||||
Client::Client(EventLoop &_loop, Partition &_partition,
|
Client::Client(EventLoop &_loop, Partition &_partition,
|
||||||
|
@ -66,27 +62,6 @@ client_new(EventLoop &loop, Partition &partition,
|
||||||
|
|
||||||
assert(fd.IsDefined());
|
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;
|
ClientList &client_list = *partition.instance.client_list;
|
||||||
if (client_list.IsFull()) {
|
if (client_list.IsFull()) {
|
||||||
LogWarning(client_domain, "Max connections reached");
|
LogWarning(client_domain, "Max connections reached");
|
||||||
|
|
|
@ -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())
|
|
|
@ -40,11 +40,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.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");
|
const Domain httpd_output_domain("httpd_output");
|
||||||
|
|
||||||
inline
|
inline
|
||||||
|
@ -130,34 +125,11 @@ HttpdOutput::OnDeferredBroadcast() noexcept
|
||||||
|
|
||||||
void
|
void
|
||||||
HttpdOutput::OnAccept(UniqueSocketDescriptor fd,
|
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
|
/* the listener socket has become readable - a client has
|
||||||
connected */
|
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);
|
const std::lock_guard<Mutex> protect(mutex);
|
||||||
|
|
||||||
/* can we allow additional client */
|
/* can we allow additional client */
|
||||||
|
|
|
@ -38,7 +38,7 @@ if get_option('httpd')
|
||||||
'httpd/HttpdClient.cxx',
|
'httpd/HttpdClient.cxx',
|
||||||
'httpd/HttpdOutputPlugin.cxx',
|
'httpd/HttpdOutputPlugin.cxx',
|
||||||
]
|
]
|
||||||
output_plugins_deps += [ event_dep, net_dep, libwrap_dep ]
|
output_plugins_deps += [ event_dep, net_dep ]
|
||||||
need_encoder = true
|
need_encoder = true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue