From e65bbe0559a2c0080dd30863df6c7011c78e4be4 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Mon, 7 May 2012 17:43:09 -0300 Subject: sshdcond - fix xmlrpc sync function call --- config/sshdcond/sshdcond.inc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'config/sshdcond/sshdcond.inc') diff --git a/config/sshdcond/sshdcond.inc b/config/sshdcond/sshdcond.inc index 43ff9a06..cd9d8018 100644 --- a/config/sshdcond/sshdcond.inc +++ b/config/sshdcond/sshdcond.inc @@ -146,38 +146,33 @@ function sshdcond_custom_php_write_config(){ function sshdcond_sync_on_changes() { global $config, $g; + if (is_array($config['installedpackages']['sshdcondsync'])) + if (!$config['installedpackages']['sshdcondsync']['config'][0]['synconchanges']) + return; + log_error("[sshdcond] xmlrpc sync is starting."); - $synconchanges = $config['installedpackages']['sshdcondsync']['config'][0]['synconchanges']; - if(!$synconchanges) - return; foreach ($config['installedpackages']['sshdcondsync']['config'] as $rs ){ foreach($rs['row'] as $sh){ $sync_to_ip = $sh['ipaddress']; $password = $sh['password']; - if($sh['username']) - $username = $sh['username']; - else - $username = 'admin'; if($password && $sync_to_ip) - sshdcond_do_xmlrpc_sync($sync_to_ip, $username, $password); + sshdcond_do_xmlrpc_sync($sync_to_ip, $password); } } log_error("[sshdcond] xmlrpc sync is ending."); } /* Do the actual XMLRPC sync */ -function sshdcond_do_xmlrpc_sync($sync_to_ip, $username, $password) { +function sshdcond_do_xmlrpc_sync($sync_to_ip, $password) { global $config, $g; - if(!$username) - return; - if(!$password) return; if(!$sync_to_ip) return; + $username='admin'; $xmlrpc_sync_neighbor = $sync_to_ip; if($config['system']['webgui']['protocol'] != "") { $synchronizetoip = $config['system']['webgui']['protocol']; @@ -230,7 +225,7 @@ function sshdcond_do_xmlrpc_sync($sync_to_ip, $username, $password) { /* tell sshdcond to reload our settings on the destionation sync host. */ $method = 'pfsense.exec_php'; $execcmd = "require_once('/usr/local/pkg/sshdcond.inc');\n"; - $execcmd .= "sync_package_sshdcond();"; + $execcmd .= "sshdcond_custom_php_write_config();"; /* assemble xmlrpc payload */ $params = array( XML_RPC_encode($password), -- cgit v1.2.3