From ce7b0c94f76a9a8fa6a43b70428c0c38240d81b2 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 24 Feb 2008 10:30:49 +0100 Subject: Added the backslash ('\') to the list of characters that need to be escaped when executing external commands --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ menu.c | 4 ++-- recording.c | 4 ++-- shutdown.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cab05b4e..85902fd9 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1062,6 +1062,8 @@ Peter Bieringer for adding more error messages and line numbers when reading EPG data and info.vdr for fixing handling "more than 3 byte" key sequences in cKbdRemote::ReadKeySequence() for suggesting to ignore lines tagged with '#' in the 'info.vdr' file of a recording + for reporting a problem with the backslash ('\') in parameters when executing + external commands Alexander Damhuis for reporting problems when deleting a timer that is currently recording diff --git a/HISTORY b/HISTORY index 0665c86b..56ff6fa4 100644 --- a/HISTORY +++ b/HISTORY @@ -5668,3 +5668,5 @@ Video Disk Recorder Revision History case a CAM menu is open). - Increased the valid range of the "Subtitle offset" setup option to -100...100 (thanks to Rolf Ahrenberg). +- Added the backslash ('\') to the list of characters that need to be escaped + when executing external commands (thanks to Peter Bieringer for reporting this one). diff --git a/menu.c b/menu.c index 0fb36cbe..37da3ddc 100644 --- a/menu.c +++ b/menu.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.479 2008/02/24 10:08:42 kls Exp $ + * $Id: menu.c 1.480 2008/02/24 10:28:46 kls Exp $ */ #include "menu.h" @@ -2127,7 +2127,7 @@ eOSState cMenuRecordings::Commands(eKeys Key) cRecording *recording = GetRecording(ri); if (recording) { cMenuCommands *menu; - eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, cString::sprintf("\"%s\"", *strescape(recording->FileName(), "\"$")))); + eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Recording commands"), &RecordingCommands, cString::sprintf("\"%s\"", *strescape(recording->FileName(), "\\\"$")))); if (Key != kNone) state = menu->ProcessKey(Key); return state; diff --git a/recording.c b/recording.c index 4ecf4a96..1535b46b 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 1.161 2008/02/16 13:31:39 kls Exp $ + * $Id: recording.c 1.162 2008/02/24 10:28:53 kls Exp $ */ #include "recording.h" @@ -1161,7 +1161,7 @@ const char *cRecordingUserCommand::command = NULL; void cRecordingUserCommand::InvokeCommand(const char *State, const char *RecordingFileName) { if (command) { - cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\"$")); + cString cmd = cString::sprintf("%s %s \"%s\"", command, State, *strescape(RecordingFileName, "\\\"$")); isyslog("executing '%s'", *cmd); SystemExec(cmd); } diff --git a/shutdown.c b/shutdown.c index ea137edf..d71a3a13 100644 --- a/shutdown.c +++ b/shutdown.c @@ -6,7 +6,7 @@ * * Original version written by Udo Richter . * - * $Id: shutdown.c 1.4 2008/01/13 14:27:29 kls Exp $ + * $Id: shutdown.c 1.5 2008/02/24 10:29:00 kls Exp $ */ #include "shutdown.h" @@ -130,7 +130,7 @@ void cShutdownHandler::SetShutdownCommand(const char *ShutdownCommand) void cShutdownHandler::CallShutdownCommand(time_t WakeupTime, int Channel, const char *File, bool UserShutdown) { time_t Delta = WakeupTime ? WakeupTime - time(NULL) : 0; - cString cmd = cString::sprintf("%s %ld %ld %d \"%s\" %d", shutdownCommand, WakeupTime, Delta, Channel, *strescape(File, "\"$"), UserShutdown); + cString cmd = cString::sprintf("%s %ld %ld %d \"%s\" %d", shutdownCommand, WakeupTime, Delta, Channel, *strescape(File, "\\\"$"), UserShutdown); isyslog("executing '%s'", *cmd); int Status = SystemExec(cmd, true); if (!WIFEXITED(Status) || WEXITSTATUS(Status)) -- cgit v1.2.3