aboutsummaryrefslogtreecommitdiffstats
path: root/src/storedPlaylist.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* storedPlaylist: prevent potential DoS from stored playlist commandsEric Wong2008-01-261-1/+15
| | | | | | | | | | | | | | | | | | | | While mpd has always protected against the infinite expansion of the main playlist by limiting its size in memory, however the new storedPlaylist code has never checked for this limit. Malicious (or clumsy) users could repeatedly append songs to stored playlists, causing files to grow increasingly large on disk. Attempting to load extremely large files into memory will require mpd to slurp that all into memory, and ultimately the file would be unusable by mpd because of the configurable playlist size limit. Now we limit stored playlists to the max_playlist_length configuration variable set by the user (default is 16384). We will refuse to append to playlist files if they hit that limit; and also refuse to load more than the specified amount of songs into memory. git-svn-id: https://svn.musicpd.org/mpd/trunk@7154 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fixed -Wshadow warningsMax Kellermann2008-01-261-4/+4
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-3/+1
| | | | | | | | | | | | | This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: remove the needless StoredPlaylist struct and just use ListEric Wong2008-01-011-74/+51
| | | | | | | | | | | Abstractions should reduce the amount of code and make things easier to follow. The StoredPlaylist struct did not do that, so get rid of it and just use our standard linked list implementation instead. diffstat agrees with me that the abstraction is pointless: 3 files changed, 60 insertions(+), 90 deletions(-) git-svn-id: https://svn.musicpd.org/mpd/trunk@7120 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: cleanup API and avoid needless heap allocations + error checksEric Wong2008-01-011-93/+56
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7119 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: cleanup load functionEric Wong2008-01-011-72/+16
| | | | | | | | | | | * stop supporting unused parentlen block, I have no idea how it was ever usable, but playlists don't work in subdirectories... * myFgets is far easier to use than fgetc loops. * Since we're using myFgets, we'll just skip lines that are too long, rather than error out and bitch and moan about things... git-svn-id: https://svn.musicpd.org/mpd/trunk@7118 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* playlist: avoid the use of newStoredPlaylist for saving active playlistsEric Wong2008-01-011-23/+0
| | | | | | It was a nice way to double the memory needed to write the playlist to a file. git-svn-id: https://svn.musicpd.org/mpd/trunk@7116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make utf8_to_fs_playlist_path universally accessibleEric Wong2008-01-011-11/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7115 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* storedPlaylist: fix compile warning (last-second internal API change)Eric Wong2008-01-011-2/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7114 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Revert r7111 and begin to properly fix storedPlaylist codeEric Wong2008-01-011-85/+72
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7112 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-23/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing calls to strdup to xstrdup.J. Alexander Treuman2007-05-261-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6270 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make sure StoredPlaylists always contain UTF-8 paths that are eitherJ. Alexander Treuman2007-05-261-20/+37
| | | | | | | | | | | | | | | | | | | | | | relative paths in the DB or URLs. The main functional difference is that playlistmove and playlistdelete will rewrite playlists in the correct encoding and remove invalid lines instead of potentially modifying them. The specific changes are: appendSongToStoredPlaylist: * Don't convert to FS charset * Don't prepend music_directory if saving absolute paths writeStoredPlaylistToPath: * Convert to FS charset * Prepend music_directory if saving absolute paths loadStoredPlaylist: * Make sure each line is either in the DB or a URL loadPlaylist: * Don't bother checking paths, since it's done in loadStoredPlaylist now git-svn-id: https://svn.musicpd.org/mpd/trunk@6266 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* More formatting/error message cleanups in storedPlaylist.c.J. Alexander Treuman2007-05-261-50/+18
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6265 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't call freeStoredPlaylist(sp) inside an if (!sp) block. It causesJ. Alexander Treuman2007-05-261-2/+0
| | | | | segfaults. git-svn-id: https://svn.musicpd.org/mpd/trunk@6264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleaning up formatting and error messages in storedPlaylist.c.J. Alexander Treuman2007-05-251-63/+25
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6263 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Adding rename command, for renaming stored playlists.J. Alexander Treuman2007-05-241-0/+65
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6246 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleaning up error messages in storedPlaylist.c.J. Alexander Treuman2007-05-241-28/+42
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fail loading the playlist on errors mid-file. The same code is used forJ. Alexander Treuman2007-05-161-0/+4
| | | | | | playlistadd, playlistdelete, etc. and would've caused the playlist to be rewritten only up to the line with the error. git-svn-id: https://svn.musicpd.org/mpd/trunk@6133 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Committing pat's rewrite of the stored playlist code. This also adds twoJ. Alexander Treuman2007-05-161-0/+473
new commands: playlistmove and playlistdelete. git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f