client/Process: explicitly disallow "idle" and "noidle" in command lists
These commands cannot possibly work with command lists because command lists are supposed to be atomic, but suspended command execution conflicts with that. Closes https://github.com/MusicPlayerDaemon/MPD/issues/2167
This commit is contained in:
@@ -52,6 +52,13 @@ Client::ProcessCommandList(bool list_ok,
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsAsyncCommmand(const char *line) noexcept
|
||||
{
|
||||
return StringIsEqual(line, "idle") || StringIsEqual(line, "noidle");
|
||||
}
|
||||
|
||||
CommandResult
|
||||
Client::ProcessLine(char *line) noexcept
|
||||
{
|
||||
@@ -67,6 +74,13 @@ Client::ProcessLine(char *line) noexcept
|
||||
return CommandResult::CLOSE;
|
||||
}
|
||||
|
||||
if (cmd_list.IsActive() && IsAsyncCommmand(line)) {
|
||||
FmtWarning(client_domain,
|
||||
"[{}] not possible in comand list: \"{}\"",
|
||||
num, line);
|
||||
return CommandResult::CLOSE;
|
||||
}
|
||||
|
||||
if (StringIsEqual(line, "noidle")) {
|
||||
if (idle_waiting) {
|
||||
/* send empty idle response and leave idle mode */
|
||||
|
||||
Reference in New Issue
Block a user