Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Bugfix the issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
netdump committed Mar 11, 2017
1 parent 9dfb75c commit 8e04340
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions netdump.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,18 @@
logError("Undefined template variable(s): " . implode(",",$template_variables_undefined), $target, $logfile);
continue;
}
// Check finish in case or answers
if (count($_TEMPLATE[$template]["cases"])!=count($_TEMPLATE[$template]["answers"]))
{
logError("Cases and answers groups count differs in template '$template'", $target, $logfile);
continue;
}
if (is_null(tabget(end($_TEMPLATE[$template]["cases"]), 3,"finish")) &&
is_null(tabget(end($_TEMPLATE[$template]["answers"]), 3,"finish")))
{
logError("Last cases or answers group must define a 'finish' action in 'template'", $target, $logfile);
continue;
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion templates/fortinet.fortios.novdom.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
array("sshpassword", "$auth[2]\n", 1)
, array("prompt", "execute backup full-config ftp ftp/" . $target_tag . ".conf $auth[5] $auth[3] $auth[4]\n", 1)
, array("prompt", "end\n", 1)
, array("prompt", "exit\n", 1)
, array("prompt", "exit\n", 1, "finish")
)
)
, "pre-exec" => array(
Expand Down
2 changes: 1 addition & 1 deletion templates/fortinet.fortios.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
, array("prompt", "config global\n", 1)
, array("prompt global", "execute backup full-config ftp ftp/" . $target_tag . ".conf $auth[5] $auth[3] $auth[4]\n", 1)
, array("prompt global", "end\n", 1)
, array("prompt", "exit\n", 1)
, array("prompt", "exit\n", 1, "finish")
)
)
, "pre-exec" => array(
Expand Down

0 comments on commit 8e04340

Please sign in to comment.