Commit 31faafea authored by Max Kellermann's avatar Max Kellermann

Client: remove the AllowFile() overload with Error parameter

Unused.
parent 6961bd61
......@@ -182,8 +182,6 @@ public:
*/
void AllowFile(Path path_fs) const;
bool AllowFile(Path path_fs, Error &error) const;
/**
* Wrapper for Instance::GetDatabase().
*/
......
......@@ -22,7 +22,6 @@
#include "protocol/Ack.hxx"
#include "fs/Path.hxx"
#include "fs/FileInfo.hxx"
#include "util/Error.hxx"
#include <unistd.h>
......@@ -50,37 +49,3 @@ Client::AllowFile(Path path_fs) const
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
#endif
}
bool
Client::AllowFile(Path path_fs, Error &error) const
{
#ifdef WIN32
(void)path_fs;
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
return false;
#else
if (uid >= 0 && (uid_t)uid == geteuid())
/* always allow access if user runs his own MPD
instance */
return true;
if (uid < 0) {
/* unauthenticated client */
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
return false;
}
FileInfo fi;
if (!GetFileInfo(path_fs, fi, error))
return false;
if (fi.GetUid() != (uid_t)uid && (fi.GetMode() & 0444) != 0444) {
/* client is not owner */
error.Set(ack_domain, ACK_ERROR_PERMISSION, "Access denied");
return false;
}
return true;
#endif
}
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