aboutsummaryrefslogtreecommitdiffstats
path: root/src/song_print.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-27 19:20:11 +0100
committerMax Kellermann <max@duempel.org>2009-02-27 19:20:11 +0100
commiteae0287466020b5b5aee137fb4599136420f89a2 (patch)
tree23c1e1202a94e130f4c3ec006d1a4894939d6b92 /src/song_print.c
parent9dd00dfab7a7991c53d2f1dcff4cc2828abf7854 (diff)
downloadmpd-eae0287466020b5b5aee137fb4599136420f89a2.tar.gz
mpd-eae0287466020b5b5aee137fb4599136420f89a2.tar.xz
mpd-eae0287466020b5b5aee137fb4599136420f89a2.zip
song_print: hide HTTP password in playlist
Added the uri_remove_auth() library function which strips username and password from a HTTP URI, and use it in song_print_url(). This allows you to add HTTP URIs to the playlist including secret username and password, without disclosing it to all MPD clients.
Diffstat (limited to '')
-rw-r--r--src/song_print.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/song_print.c b/src/song_print.c
index 60e16f941..1b62f324e 100644
--- a/src/song_print.c
+++ b/src/song_print.c
@@ -22,6 +22,7 @@
#include "directory.h"
#include "tag_print.h"
#include "client.h"
+#include "uri.h"
void
song_print_url(struct client *client, struct song *song)
@@ -30,7 +31,16 @@ song_print_url(struct client *client, struct song *song)
client_printf(client, "%s%s/%s\n", SONG_FILE,
directory_get_path(song->parent), song->url);
} else {
- client_printf(client, "%s%s\n", SONG_FILE, song->url);
+ char *allocated;
+ const char *uri;
+
+ uri = allocated = uri_remove_auth(song->url);
+ if (uri == NULL)
+ uri = song->url;
+
+ client_printf(client, "%s%s\n", SONG_FILE, uri);
+
+ g_free(allocated);
}
}