Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Patch for mpd (tag: release-0.17.4) that fixes queuing files outside of MPD's library.
diff --git a/src/client_file.c b/src/client_file.c
index 2ee4333..8174c3b 100644
--- a/src/client_file.c
+++ b/src/client_file.c
@@ -44,12 +44,18 @@ client_allow_file(const struct client *client, const char *path_fs,
instance */
return true;
+ /* Pretty sure this check will never work.
if (uid <= 0) {
- /* unauthenticated client */
+ char msg[100];
+ sprintf(msg, "Access denied (Bad UID: %d)", uid);
+ // unauthenticated client
+ // g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION,
+ // "Access denied (BAD UID)"); *
g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION,
- "Access denied");
+ msg);
return false;
}
+ */
struct stat st;
if (stat(path_fs, &st) < 0) {
@@ -61,7 +67,7 @@ client_allow_file(const struct client *client, const char *path_fs,
if (st.st_uid != (uid_t)uid && (st.st_mode & 0444) != 0444) {
/* client is not owner */
g_set_error(error_r, ack_quark(), ACK_ERROR_PERMISSION,
- "Access denied");
+ "Access denied (Not owner and not world-readable)");
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment