Skip to content

Commit

Permalink
OVMS event scripts are run in secure mode
Browse files Browse the repository at this point in the history
  • Loading branch information
markwj committed Mar 11, 2018
1 parent 636c97c commit 037bddc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vehicle/OVMS.V3/main/ovms_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ static const char *TAG = "script";

OvmsScripts MyScripts __attribute__ ((init_priority (1600)));

static void script_ovms(bool print, int verbosity, OvmsWriter* writer, FILE* sf)
static void script_ovms(bool print, int verbosity, OvmsWriter* writer, FILE* sf, bool secure=false)
{
BufferedShell* bs = new BufferedShell(print, verbosity);
if (secure) bs->SetSecure(true);
char* cmdline = new char[_COMMAND_LINE_LEN];
while(fgets(cmdline, _COMMAND_LINE_LEN, sf) != NULL )
{
Expand Down Expand Up @@ -106,7 +107,7 @@ void OvmsScripts::AllScripts(std::string path)
if (sf)
{
ESP_LOGI(TAG, "Running script %s", fpath.c_str());
script_ovms(false, COMMAND_RESULT_MINIMAL, ConsoleAsync::Instance(), sf);
script_ovms(false, COMMAND_RESULT_MINIMAL, ConsoleAsync::Instance(), sf, true);
}
}
closedir(dir);
Expand Down

0 comments on commit 037bddc

Please sign in to comment.