Commit 977a4570 authored by Max Kellermann's avatar Max Kellermann

Merge branch 'v0.21.x'

parents 6c2077eb 6bab3bcf
...@@ -7,6 +7,7 @@ ver 0.22 (not yet released) ...@@ -7,6 +7,7 @@ ver 0.22 (not yet released)
ver 0.21.7 (not yet released) ver 0.21.7 (not yet released)
* require Meson 0.49.0 for native libgcrypt-config support * require Meson 0.49.0 for native libgcrypt-config support
* fix build failure with -Dlocal_socket=false
ver 0.21.6 (2019/03/17) ver 0.21.6 (2019/03/17)
* protocol * protocol
......
...@@ -873,7 +873,7 @@ It is highly recommended to configure a fixed format, because a stream cannot sw ...@@ -873,7 +873,7 @@ It is highly recommended to configure a fixed format, because a stream cannot sw
* - **port P** * - **port P**
- Binds the HTTP server to the specified port. - Binds the HTTP server to the specified port.
* - **bind_to_address ADDR** * - **bind_to_address ADDR**
- Binds the HTTP server to the specified address (IPv4, IPv6 or UNIX socket). Multiple addresses in parallel are not supported. - Binds the HTTP server to the specified address (IPv4, IPv6 or local socket). Multiple addresses in parallel are not supported.
* - **encoder NAME** * - **encoder NAME**
- Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`. - Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`.
* - **max_clients MC** * - **max_clients MC**
......
...@@ -721,7 +721,7 @@ run playlist plugins instead of the hard-coded simple ...@@ -721,7 +721,7 @@ run playlist plugins instead of the hard-coded simple
`m3u` parser. They can access playlists in `m3u` parser. They can access playlists in
the music directory (relative path including the suffix), the music directory (relative path including the suffix),
playlists in arbitrary location (absolute path including the suffix; playlists in arbitrary location (absolute path including the suffix;
allowed only for clients that are connected via UNIX domain socket), or allowed only for clients that are connected via local socket), or
remote playlists (absolute URI with a supported scheme). remote playlists (absolute URI with a supported scheme).
:command:`listplaylist {NAME}` :command:`listplaylist {NAME}`
...@@ -931,7 +931,7 @@ The music database ...@@ -931,7 +931,7 @@ The music database
This command may be used to list metadata of remote This command may be used to list metadata of remote
files (e.g. URI beginning with "http://" or "smb://"). files (e.g. URI beginning with "http://" or "smb://").
Clients that are connected via UNIX domain socket may Clients that are connected via local socket may
use this command to read the tags of an arbitrary local use this command to read the tags of an arbitrary local
file (URI is an absolute path). file (URI is an absolute path).
...@@ -1222,7 +1222,7 @@ Reflection ...@@ -1222,7 +1222,7 @@ Reflection
:command:`config` :command:`config`
Dumps configuration values that may be interesting for Dumps configuration values that may be interesting for
the client. This command is only permitted to "local" the client. This command is only permitted to "local"
clients (connected via UNIX domain socket). clients (connected via local socket).
The following response attributes are available: The following response attributes are available:
......
...@@ -29,10 +29,8 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne ...@@ -29,10 +29,8 @@ ServerSocketAddGeneric(ServerSocket &server_socket, const char *address, unsigne
server_socket.AddPort(port); server_socket.AddPort(port);
} else if (address[0] == '/' || address[0] == '~') { } else if (address[0] == '/' || address[0] == '~') {
server_socket.AddPath(ParsePath(address)); server_socket.AddPath(ParsePath(address));
#ifdef __linux__
} else if (address[0] == '@') { } else if (address[0] == '@') {
server_socket.AddAbstract(address); server_socket.AddAbstract(address);
#endif
} else { } else {
server_socket.AddHost(address, port); server_socket.AddHost(address, port);
} }
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
class ServerSocket; class ServerSocket;
/** /**
* Sets the address or unix socket of a ServerSocket instance * Sets the address or local socket of a ServerSocket instance
* There are three possible ways * There are three possible ways
* 1) Set address to a valid ip address and specify port. * 1) Set address to a valid ip address and specify port.
* server_socket will listen on this address/port tuple. * server_socket will listen on this address/port tuple.
* 2) Set address to null and specify port. * 2) Set address to null and specify port.
* server_socket will listen on ANY address on that port. * server_socket will listen on ANY address on that port.
* 3) Set address to a path of a unix socket. port is ignored. * 3) Set address to a path of a local socket. port is ignored.
* server_socket will listen on this unix socket. * server_socket will listen on this local socket.
* *
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
* *
......
...@@ -392,16 +392,23 @@ ServerSocket::AddPath(AllocatedPath &&path) ...@@ -392,16 +392,23 @@ ServerSocket::AddPath(AllocatedPath &&path)
#else /* !HAVE_UN */ #else /* !HAVE_UN */
(void)path; (void)path;
throw std::runtime_error("UNIX domain socket support is disabled"); throw std::runtime_error("Local socket support is disabled");
#endif /* !HAVE_UN */ #endif /* !HAVE_UN */
} }
#ifdef __linux__
void void
ServerSocket::AddAbstract(const char *name) ServerSocket::AddAbstract(const char *name)
{ {
#if !defined(__linux__)
(void)name;
throw std::runtime_error("Abstract sockets are only available on Linux");
#elif !defined(HAVE_UN)
(void)name;
throw std::runtime_error("Local socket support is disabled");
#else
assert(name != nullptr); assert(name != nullptr);
assert(*name == '@'); assert(*name == '@');
...@@ -409,6 +416,5 @@ ServerSocket::AddAbstract(const char *name) ...@@ -409,6 +416,5 @@ ServerSocket::AddAbstract(const char *name)
address.SetLocal(name); address.SetLocal(name);
AddAddress(std::move(address)); AddAddress(std::move(address));
}
#endif #endif
}
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
void AddHost(const char *hostname, unsigned port); void AddHost(const char *hostname, unsigned port);
/** /**
* Add a listener on a Unix domain socket. * Add a listener on a local socket.
* *
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
* *
...@@ -99,7 +99,6 @@ public: ...@@ -99,7 +99,6 @@ public:
*/ */
void AddPath(AllocatedPath &&path); void AddPath(AllocatedPath &&path);
#ifdef __linux__
/** /**
* Add a listener on an abstract local socket (Linux specific). * Add a listener on an abstract local socket (Linux specific).
* *
...@@ -109,7 +108,6 @@ public: ...@@ -109,7 +108,6 @@ public:
* instead of a null byte * instead of a null byte
*/ */
void AddAbstract(const char *name); void AddAbstract(const char *name);
#endif
/** /**
* Add a socket descriptor that is accepting connections. After this * Add a socket descriptor that is accepting connections. After this
......
...@@ -35,7 +35,7 @@ socket_bind_listen(int domain, int type, int protocol, ...@@ -35,7 +35,7 @@ socket_bind_listen(int domain, int type, int protocol,
throw MakeSocketError("Failed to create socket"); throw MakeSocketError("Failed to create socket");
#ifdef HAVE_UN #ifdef HAVE_UN
if (domain == AF_UNIX) { if (domain == AF_LOCAL) {
/* Prevent access until right permissions are set */ /* Prevent access until right permissions are set */
fchmod(fd.Get(), 0); fchmod(fd.Get(), 0);
} }
......
...@@ -32,7 +32,7 @@ class SocketAddress; ...@@ -32,7 +32,7 @@ class SocketAddress;
/** /**
* Creates a socket listening on the specified address. This is a * Creates a socket listening on the specified address. This is a
* shortcut for socket(), bind() and listen(). * shortcut for socket(), bind() and listen().
* When a unix socket is created (domain == AF_UNIX), its * When a local socket is created (domain == AF_LOCAL), its
* permissions will be stripped down to prevent unauthorized * permissions will be stripped down to prevent unauthorized
* access. The caller is responsible to apply proper permissions * access. The caller is responsible to apply proper permissions
* at a later point. * at a later point.
......
...@@ -106,7 +106,7 @@ ToString(SocketAddress address) noexcept ...@@ -106,7 +106,7 @@ ToString(SocketAddress address) noexcept
{ {
#ifdef HAVE_UN #ifdef HAVE_UN
if (address.GetFamily() == AF_LOCAL) if (address.GetFamily() == AF_LOCAL)
/* return path of UNIX domain sockets */ /* return path of local socket */
return LocalAddressToString(*(const sockaddr_un *)address.GetAddress(), return LocalAddressToString(*(const sockaddr_un *)address.GetAddress(),
address.GetSize()); address.GetSize());
#endif #endif
......
...@@ -165,8 +165,8 @@ public: ...@@ -165,8 +165,8 @@ public:
return GetCommand(); return GetCommand();
} }
void SubmitReplayGain(const ReplayGainInfo *) {} void SubmitReplayGain(const ReplayGainInfo *) override {}
void SubmitMixRamp(MixRampInfo &&) {} void SubmitMixRamp(MixRampInfo &&) override {}
}; };
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment