/[projects]/smsdaemon/plugins/ShellExecPlugin.cpp
ViewVC logotype

Diff of /smsdaemon/plugins/ShellExecPlugin.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 55 by torben, Wed Jun 11 08:25:34 2008 UTC revision 56 by torben, Wed Jun 11 15:55:18 2008 UTC
# Line 3  Line 3 
3    
4  #include "util.h"  #include "util.h"
5    
6  ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand)  ShellExecPlugin::ShellExecPlugin(std::string pluginCommand, std::string exeCommand, bool allowParameters)
7    : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ),    : Plugin(pluginCommand, std::string("ShellExec: ")+exeCommand ),
8    _exeCommand(exeCommand)    _exeCommand(exeCommand),
9      _allowParameters(allowParameters)
10  {  {
11  }  }
12    
13  void ShellExecPlugin::Execute(IGsmModem& modem, SMS& sms)  void ShellExecPlugin::Execute(IGsmModem& modem, SMS& sms)
14  {  {
15          std::string parameters = GetSmsData(sms);          std::string command = _exeCommand;
         parameters = Util::str_replace(parameters,";");  
16    
17          std::string command = _exeCommand + " " + parameters;          if (_allowParameters)
18            {
19                    std::string parameters = GetSmsData(sms);
20    
21                    parameters = Util::str_replace(parameters, "||");
22                    parameters = Util::str_replace(parameters, "&&");
23                    parameters = Util::str_replace(parameters, ";");
24                    parameters = Util::str_replace(parameters, "'");
25                    parameters = Util::str_replace(parameters, "\"");
26    
27                    command += " ";
28                    command += parameters;
29            }
30          int retval = ::system( command.c_str()  );          int retval = ::system( command.c_str()  );
31    
32          std::string message;          std::string message;

Legend:
Removed from v.55  
changed lines
  Added in v.56

  ViewVC Help
Powered by ViewVC 1.1.20