aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-03-06 22:01:24 +0100
committerMax Kellermann <max@duempel.org>2012-03-06 22:10:54 +0100
commit1e60a4386a78ed16fc3fdf99c1f398b607178804 (patch)
treed0a7153adfb1869449141ca2c96b8d70561f8656 /src/command.c
parente9f1b53ae6819170ea06f4347a2c5c631044c1f3 (diff)
downloadmpd-1e60a4386a78ed16fc3fdf99c1f398b607178804.tar.gz
mpd-1e60a4386a78ed16fc3fdf99c1f398b607178804.tar.xz
mpd-1e60a4386a78ed16fc3fdf99c1f398b607178804.zip
playlist_edit: move UID check to client_allow_file()
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/command.c b/src/command.c
index 655ed7b1a..793737964 100644
--- a/src/command.c
+++ b/src/command.c
@@ -53,6 +53,7 @@
#include "client_idle.h"
#include "client_internal.h"
#include "client_subscribe.h"
+#include "client_file.h"
#include "tag_print.h"
#include "path.h"
#include "replay_gain_config.h"
@@ -441,14 +442,16 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
enum playlist_result result;
if (strncmp(uri, "file:///", 8) == 0) {
-#ifdef WIN32
- result = PLAYLIST_RESULT_DENIED;
-#else
+ const char *path = uri + 7;
+
+ GError *error = NULL;
+ if (!client_allow_file(client, path, &error))
+ return print_error(client, error);
+
result = playlist_append_file(&g_playlist,
client->player_control,
- uri + 7, client_get_uid(client),
+ path,
NULL);
-#endif
return print_playlist_result(client, result);
}
@@ -479,15 +482,16 @@ handle_addid(struct client *client, int argc, char *argv[])
enum playlist_result result;
if (strncmp(uri, "file:///", 8) == 0) {
-#ifdef WIN32
- result = PLAYLIST_RESULT_DENIED;
-#else
+ const char *path = uri + 7;
+
+ GError *error = NULL;
+ if (!client_allow_file(client, path, &error))
+ return print_error(client, error);
+
result = playlist_append_file(&g_playlist,
client->player_control,
- uri + 7,
- client_get_uid(client),
+ path,
&added_id);
-#endif
} else {
if (uri_has_scheme(uri) && !uri_supported_scheme(uri)) {
command_error(client, ACK_ERROR_NO_EXIST,