aboutsummaryrefslogtreecommitdiffstats
path: root/packages/carp_sync_client.php
diff options
context:
space:
mode:
Diffstat (limited to 'packages/carp_sync_client.php')
-rw-r--r--packages/carp_sync_client.php27
1 files changed, 16 insertions, 11 deletions
diff --git a/packages/carp_sync_client.php b/packages/carp_sync_client.php
index a3fdf656..5bbf3c16 100644
--- a/packages/carp_sync_client.php
+++ b/packages/carp_sync_client.php
@@ -1,3 +1,5 @@
+#!/usr/local/bin/php
+<?php
/*
carp_sync.php
part of pfSense (www.pfSense.com)
@@ -41,8 +43,8 @@ global $config;
if(!function_exists('carp_sync_xml')) {
function carp_sync_xml($url, $password, $section, $section_xml, $method = 'pfsense.restore_config_section') {
$params = array(new XML_RPC_Value($password, 'string'),
- new XML_RPC_Value($section, 'string'),
- new XML_RPC_Value($section_xml, 'string'));
+ new XML_RPC_Value($section, 'array'),
+ new XML_RPC_Value($section_xml, 'array'));
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url);
$cli->setCredentials('admin', $password);
@@ -56,24 +58,27 @@ if($already_processed != 1) {
foreach($config['installedpackages']['carpsettings']['config'] as $carp) {
if($carp['synchronizetoip'] != "" ) {
$synchronizetoip = $carp['synchronizetoip'];
+ $sections = array();
+ $sections_xml = array();
if($carp['synchronizerules'] != "" and is_array($config['filter'])) {
- $current_rules_section = backup_config_section("filter");
- carp_sync_xml($synchronizetoip, $carp['password'], 'filter', $current_rules_section);
+ $sections_xml[] = new XML_RPC_Value(backup_config_section("filter"), 'string');
+ $sections[] = new XML_RPC_Value('filter', 'string');
}
if($carp['synchronizenat'] != "" and is_array($config['nat'])) {
- $current_nat_section = backup_config_section("nat");
- carp_sync_xml($synchronizetoip, $carp['password'], 'nat', $current_nat_section);
+ $sections_xml[] = new XML_RPC_Value(backup_config_section("nat"), 'string');
+ $sections[] = new XML_RPC_Value('nat', 'string');
}
if($carp['synchronizealiases'] != "" and is_array($config['aliases'])) {
- $current_aliases_section = backup_config_section("aliases");
- carp_sync_xml($synchronizetoip, $carp['password'], 'alias', $current_aliases_section);
+ $sections_xml[] = new XML_RPC_Value(backup_config_section("aliases"), 'string');
+ $sections[] = new XML_RPC_Value('aliases', 'string');
}
if($carp['synchronizetrafficshaper'] != "" and is_array($config['shaper'])) {
- $current_shaper_section = backup_config_section("shaper");
- carp_sync_xml($synchronizetoip, $carp['password'], 'shaper', $current_shaper_section);
+ $sections_xml[] = new XML_RPC_Value(backup_config_section("shaper"), 'string');
+ $sections[] = new XML_RPC_Value('shaper', 'string');
}
+ carp_sync_xml($synchronizetoip, $carp['password'], $sections, $sections_xml);
+ $cli = new XML_RPC_Client('/xmlrpc.php', $synchronizetoip);
$msg = new XML_RPC_Message('pfsense.filter_configure', array(new XML_RPC_Value($carp['password'], 'string')));
- $cli = new XML_RPC_Client('/xmlrpc.php', $url);
$cli->setCredentials('admin', $carp['password']);
$cli->send($msg);
}