aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c6
-rw-r--r--src/path.c40
-rw-r--r--src/path.h3
3 files changed, 2 insertions, 47 deletions
diff --git a/src/command.c b/src/command.c
index 452568238..dc71f1d1a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -830,10 +830,8 @@ handle_update(struct client *client, mpd_unused int argc, char *argv[])
unsigned ret;
assert(argc <= 2);
- if (argc == 2 && !(path = sanitizePathDup(argv[1]))) {
- command_error(client, ACK_ERROR_ARG, "invalid path");
- return COMMAND_RETURN_ERROR;
- }
+ if (argc == 2)
+ path = g_strdup(argv[1]);
ret = directory_update_init(path);
if (ret > 0) {
diff --git a/src/path.c b/src/path.c
index 62a2362b5..f241fce8c 100644
--- a/src/path.c
+++ b/src/path.c
@@ -168,43 +168,3 @@ char *pfx_dir(char *dst,
/* this is weird, but directory.c can use it more safely/efficiently */
return (dst + pfx_len + 1);
}
-
-char *sanitizePathDup(const char *path)
-{
- int len = strlen(path) + 1;
- char *ret = xmalloc(len);
- char *cp = ret;
-
- memset(ret, 0, len);
-
- len = 0;
-
- /* eliminate more than one '/' in a row, like "///" */
- while (*path) {
- while (*path == '/')
- path++;
- if (*path == '.') {
- /* we don't want to have hidden directories, or '.' or
- ".." in our path */
- free(ret);
- return NULL;
- }
- while (*path && *path != '/') {
- *(cp++) = *(path++);
- len++;
- }
- if (*path == '/') {
- *(cp++) = *(path++);
- len++;
- }
- }
-
- if (len && ret[len - 1] == '/') {
- len--;
- ret[len] = '\0';
- }
-
- DEBUG("sanitized: %s\n", ret);
-
- return xrealloc(ret, len + 1);
-}
diff --git a/src/path.h b/src/path.h
index e341169b0..c1003d846 100644
--- a/src/path.h
+++ b/src/path.h
@@ -55,7 +55,4 @@ char *pfx_dir(char *dst,
const char *path, const size_t path_len,
const char *pfx, const size_t pfx_len);
-/* strips extra "///" and leading "/" and trailing "/" */
-char *sanitizePathDup(const char *path);
-
#endif