Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions adapters/stormshield/adaptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
require_once 'smserror/sms_error.php';
require_once 'smsd/sms_common.php';

require_once load_once('stormshield', 'netasq_connect.php');
require_once load_once('stormshield', 'netasq_apply_conf.php');
require_once load_once('stormshield', 'connect.php');
require_once load_once('stormshield', 'apply_conf.php');

require_once "$db_objects";

Expand All @@ -19,7 +19,7 @@
*/
function sd_connect($ip_addr = '', $login = '', $passwd = '')
{
$ret = netasq_connect($ip_addr, $login, $passwd);
$ret = connect($ip_addr, $login, $passwd);

return $ret;
}
Expand All @@ -30,7 +30,7 @@ function sd_connect($ip_addr = '', $login = '', $passwd = '')
*/
function sd_disconnect($clean_exit = false)
{
$ret = netasq_disconnect();
$ret = disconnect();

return $ret;
}
Expand All @@ -47,7 +47,7 @@ function sd_apply_conf($configuration, $need_sd_connection = false)
sd_connect();
}

$ret = netasq_apply_conf($configuration);
$ret = apply_conf($configuration);

if ($need_sd_connection)
{
Expand All @@ -57,32 +57,29 @@ function sd_apply_conf($configuration, $need_sd_connection = false)
return $ret;
}


/**
* Execute a command on a device
* @param $cmd
* @param $need_sd_connection
*/
function sd_execute_command($cmd, $need_sd_connection = false)
{
global $sms_sd_ctx;
function sd_execute_command($cmd, $need_sd_connection = false) {
global $sms_sd_ctx;

if ($need_sd_connection)
{
$ret = sd_connect();
if ($ret !== SMS_OK)
{
return false;
}
}
if ($need_sd_connection) {
$ret = sd_connect ();
if ($ret !== SMS_OK) {
return false;
}
}

$ret = sendexpectone(__FILE__.':'.__LINE__, $sms_sd_ctx, $cmd);
$ret = sendexpectone ( __FILE__ . ':' . __LINE__, $sms_sd_ctx, $cmd );

if ($need_sd_connection)
{
sd_disconnect(true);
}
if ($need_sd_connection) {
sd_disconnect ( true );
}

return $ret;
return $ret;
}

?>
35 changes: 35 additions & 0 deletions adapters/stormshield/apply_conf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

require_once load_once('stormshield', 'connect.php');

/**
* Apply the configuration
* @param string $configuration configuration to apply
*/
function apply_conf($configuration)
{
global $sms_sd_ctx;
global $SMS_RETURN_BUF;

// Save the configuration applied on the router
save_result_file($configuration, 'conf.applied');
$SMS_OUTPUT_BUF = '';

$line = get_one_line($configuration);
while ($line !== false)
{
$line = trim($line);

if (!empty($line))
{
$res = sendexpectone(__FILE__ . ':' . __LINE__, $sms_sd_ctx, $line, '');

$SMS_RETURN_BUF = json_encode($res);
}
$line = get_one_line($configuration);
}

return SMS_OK;
}

?>
13 changes: 0 additions & 13 deletions adapters/stormshield/apply_errors.php

This file was deleted.

19 changes: 0 additions & 19 deletions adapters/stormshield/common.php

This file was deleted.

6 changes: 3 additions & 3 deletions adapters/stormshield/conf/sms_router.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stormshield Generic
model 16010401:16010401
path stormshield
asset-script-name netasq_mgmt.php
poll-script-name netasq_availability.php
report-model Netasq
asset-script-name stormshield_mgmt.php
report-model Stormshield
config-type CONF_BIN
Loading