summaryrefslogtreecommitdiffstats
path: root/etc/rc.filter_synchronize
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-06-14 16:41:15 -0400
committerjim-p <jimp@pfsense.org>2011-06-14 16:41:15 -0400
commite49d4564dbf6be680e4d3c91c00a798e390fa358 (patch)
treecec495f96af3d202a02ee8c4522b076142158424 /etc/rc.filter_synchronize
parent424be584c34531d52ac0da8a5e954847e158c6cf (diff)
parent144fbff2a146d9eb3921e763f6bcc7bde39bf5f9 (diff)
downloadpfsense-e49d4564dbf6be680e4d3c91c00a798e390fa358.zip
pfsense-e49d4564dbf6be680e4d3c91c00a798e390fa358.tar.gz
Merge remote branch 'upstream/master'
Conflicts: etc/inc/globals.inc etc/inc/upgrade_config.inc
Diffstat (limited to 'etc/rc.filter_synchronize')
-rwxr-xr-xetc/rc.filter_synchronize38
1 files changed, 19 insertions, 19 deletions
diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize
index 2700eac..8c89f81 100755
--- a/etc/rc.filter_synchronize
+++ b/etc/rc.filter_synchronize
@@ -87,7 +87,7 @@ function remove_special_characters($string) {
return $string;
}
-function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host_firmware_version') {
+function carp_check_version($url, $username, $password, $port = 80, $method = 'pfsense.host_firmware_version') {
global $config, $g;
if(file_exists("{$g['varrun_path']}/booting") || $g['booting'])
@@ -101,10 +101,8 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
while ($numberofruns < 2) {
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
- /* XXX: Configurable from the GUI?! */
- $username = "admin";
$cli->setCredentials($username, $password);
- if($numberofruns > 1)
+ if($numberofruns > 0)
$cli->setDebug(1);
/* send our XMLRPC message and timeout after 240 seconds */
$resp = $cli->send($msg, "240");
@@ -138,7 +136,7 @@ function carp_check_version($url, $password, $port = 80, $method = 'pfsense.host
return false;
}
-function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsense.restore_config_section') {
+function carp_sync_xml($url, $username, $password, $sections, $port = 80, $method = 'pfsense.restore_config_section') {
global $config, $g;
if(file_exists("{$g['varrun_path']}/booting") || $g['booting'])
@@ -151,11 +149,11 @@ function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsens
/* strip out nosync items */
if (is_array($config_copy['nat']['advancedoutbound']['rule'])) {
- $rulescnt = count($config_copy['nat']['advancedoutbound']['rule']);
- for ($x = 0; $x < $rulescnt; $x++) {
- $config_copy['nat']['advancedoutbound']['rule'][$x]['descr'] = remove_special_characters($config_copy['nat']['advancedoutbound']['rule'][$x]['descr']);
- if (isset ($config_copy['nat']['advancedoutbound']['rule'][$x]['nosync']))
- unset ($config_copy['nat']['advancedoutbound']['rule'][$x]);
+ $rulescnt = count($config_copy['nat']['advancedoutbound']['rule']);
+ for ($x = 0; $x < $rulescnt; $x++) {
+ $config_copy['nat']['advancedoutbound']['rule'][$x]['descr'] = remove_special_characters($config_copy['nat']['advancedoutbound']['rule'][$x]['descr']);
+ if (isset ($config_copy['nat']['advancedoutbound']['rule'][$x]['nosync']))
+ unset ($config_copy['nat']['advancedoutbound']['rule'][$x]);
}
}
if (is_array($config_copy['nat']['rule'])) {
@@ -236,10 +234,8 @@ function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsens
log_error("Beginning XMLRPC sync to {$url}:{$port}.");
$msg = new XML_RPC_Message($method, $params);
$cli = new XML_RPC_Client('/xmlrpc.php', $url, $port);
- /* XXX: Configurable from the GUI?! */
- $username = "admin";
$cli->setCredentials($username, $password);
- if($numberofruns > 1)
+ if($numberofruns > 0)
$cli->setDebug(1);
/* send our XMLRPC message and timeout after 240 seconds */
$resp = $cli->send($msg, "240");
@@ -258,8 +254,10 @@ function carp_sync_xml($url, $password, $sections, $port = 80, $method = 'pfsens
log_error($error);
file_notice("sync_settings", $error, "Settings Sync", "");
exit;
- } else
+ } else {
log_error("XMLRPC sync successfully completed with {$url}:{$port}.");
+ update_filter_reload_status("XMLRPC sync successfully completed with {$url}:{$port}.");
+ }
$numberofruns = 3;
}
$numberofruns++;
@@ -386,21 +384,23 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) {
if ($carp['synchronizecaptiveportal'] != "" and is_array($config['vouchers']))
$sections[] = 'vouchers';
if (count($sections) > 0) {
- if (!carp_check_version($synchronizetoip, $carp['password'], $port))
+ if (empty($carp['username']))
+ $username = "admin";
+ else
+ $username = $carp['username'];
+ if (!carp_check_version($synchronizetoip, $username, $carp['password'], $port))
break;
update_filter_reload_status("Signaling CARP reload signal...");
- carp_sync_xml($synchronizetoip, $carp['password'], $sections, $port);
+ carp_sync_xml($synchronizetoip, $username, $carp['password'], $sections, $port);
if (is_array($mergesections))
- carp_sync_xml($synchronizetoip, $carp['password'], $mergesections, $port, 'pfsense.restore_config_section');
+ carp_sync_xml($synchronizetoip, $username, $carp['password'], $mergesections, $port, 'pfsense.restore_config_section');
$cli = new XML_RPC_Client('/xmlrpc.php', $synchronizetoip, $port);
$params = array(
XML_RPC_encode($carp['password'])
);
$msg = new XML_RPC_Message('pfsense.filter_configure', $params);
- /* XXX: Configurable from the GUI */
- $username = "admin";
$cli->setCredentials($username, $carp['password']);
$resp = $cli->send($msg, "900");
OpenPOWER on IntegriCloud