Skip to content

Commit cdcee16

Browse files
committed
client/File: improve error message
Users are confused by "Access denied". Let's write an error message that is more clear. Closes #2184
1 parent 83c2d9c commit cdcee16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/client/File.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Client::AllowFile(Path path_fs) const
2828
#ifdef _WIN32
2929
(void)path_fs;
3030

31-
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
31+
throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files not implemented on Windows");
3232
#else
3333
if (uid >= 0 && (uid_t)uid == geteuid())
3434
/* always allow access if user runs his own MPD
@@ -37,12 +37,12 @@ Client::AllowFile(Path path_fs) const
3737

3838
if (uid < 0)
3939
/* unauthenticated client */
40-
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
40+
throw ProtocolError(ACK_ERROR_PERMISSION, "Access to local files via TCP is not allowed");
4141

4242
const FileInfo fi(path_fs);
4343

4444
if (fi.GetUid() != (uid_t)uid && (fi.GetMode() & 0444) != 0444)
4545
/* client is not owner */
46-
throw ProtocolError(ACK_ERROR_PERMISSION, "Access denied");
46+
throw ProtocolError(ACK_ERROR_PERMISSION, "Access to this local file denied due to file permissions");
4747
#endif
4848
}

0 commit comments

Comments
 (0)