changed escaping of shell args in status notifier command: escape each arg separately...
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 21 May 2014 10:06:04 +0000 (12:06 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 21 May 2014 10:06:04 +0000 (12:06 +0200)
src/link/statusnotifiercommand.cpp

index 3b9cb51..3372e8c 100644 (file)
@@ -24,6 +24,7 @@ on this file might be covered by the GNU General Public License.
 #include <iostream>
 
 #include <boost/assert.hpp>
+#include <boost/foreach.hpp>
 
 #include <logfunc.hpp>
 #include <stringfunc.hxx>
@@ -133,8 +134,10 @@ string StatusNotifierCommand::get_arguments_string() const
     // retrieve the arguments string from within the command string
     const size_t args_begin_pos = CommandStr.find( " " ) + 1;
     const size_t args_end_pos = CommandStr.length();
-    string args = CommandStr.substr( args_begin_pos, args_end_pos );
-    args = escape_shellarg( args );
-
-    return args;
+    std::list< string > args = I2n::split_string(
+            CommandStr.substr( args_begin_pos, args_end_pos ),
+            " ", true);
+    BOOST_FOREACH( string arg, args )
+        arg = escape_shellarg( arg );
+    return I2n::join_string( args, " " );
 }