aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-11-18 21:38:44 +0100
committerMax Kellermann <max@duempel.org>2014-11-18 21:38:44 +0100
commitdc03f003ac8e1d569b2d8b679e4f84b7602d560e (patch)
treed7af25f884fb1810c7edaf6fb372aa80cacfa5b2 /src
parent460cfba6ff76ed58e6f6778cfeb9dd424d7fe75a (diff)
parent7aa2104596f283c6af22b7b721267065cda86237 (diff)
downloadmpd-dc03f003ac8e1d569b2d8b679e4f84b7602d560e.tar.gz
mpd-dc03f003ac8e1d569b2d8b679e4f84b7602d560e.tar.xz
mpd-dc03f003ac8e1d569b2d8b679e4f84b7602d560e.zip
Merge tag 'v0.18.18' into v0.19.x
Diffstat (limited to '')
-rw-r--r--src/client/Client.hxx2
-rw-r--r--src/client/ClientFile.cxx2
-rw-r--r--src/event/ServerSocket.cxx2
-rw-r--r--src/fs/AllocatedPath.cxx6
4 files changed, 8 insertions, 4 deletions
diff --git a/src/client/Client.hxx b/src/client/Client.hxx
index 849a11ed4..c0a940ded 100644
--- a/src/client/Client.hxx
+++ b/src/client/Client.hxx
@@ -127,7 +127,7 @@ public:
* a local (UNIX domain) socket?
*/
bool IsLocal() const {
- return uid > 0;
+ return uid >= 0;
}
unsigned GetPermission() const {
diff --git a/src/client/ClientFile.cxx b/src/client/ClientFile.cxx
index eba64d09c..3ea8034d2 100644
--- a/src/client/ClientFile.cxx
+++ b/src/client/ClientFile.cxx
@@ -41,7 +41,7 @@ Client::AllowFile(Path path_fs, Error &error) const
instance */
return true;
- if (uid <= 0) {
+ if (uid < 0) {
/* unauthenticated client */
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
return false;
diff --git a/src/event/ServerSocket.cxx b/src/event/ServerSocket.cxx
index ce70a969b..313f0a6cf 100644
--- a/src/event/ServerSocket.cxx
+++ b/src/event/ServerSocket.cxx
@@ -130,7 +130,7 @@ get_remote_uid(int fd)
socklen_t len = sizeof (cred);
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &len) < 0)
- return 0;
+ return -1;
return cred.uid;
#else
diff --git a/src/fs/AllocatedPath.cxx b/src/fs/AllocatedPath.cxx
index 30ce7e3a9..ceaad73ea 100644
--- a/src/fs/AllocatedPath.cxx
+++ b/src/fs/AllocatedPath.cxx
@@ -46,7 +46,11 @@ AllocatedPath
AllocatedPath::FromUTF8(const char *path_utf8)
{
#ifdef HAVE_GLIB
- return AllocatedPath(Donate(), ::PathFromUTF8(path_utf8));
+ char *path = ::PathFromUTF8(path_utf8);
+ if (path == nullptr)
+ return AllocatedPath::Null();
+
+ return AllocatedPath(Donate(), path);
#else
return FromFS(path_utf8);
#endif