diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-02-14 04:57:31 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-02-14 04:57:31 +0000 |
commit | d5d2c5145ab0a490257cff246ee48a3da7ee4d3e (patch) | |
tree | a104123c096ce8c07637c71aeacee484105d5899 | |
parent | cdcb273e5e757051326de680f90f41ebb3ec4f68 (diff) | |
download | pfsense-d5d2c5145ab0a490257cff246ee48a3da7ee4d3e.zip pfsense-d5d2c5145ab0a490257cff246ee48a3da7ee4d3e.tar.gz |
* Add xmlrpc declarations missed in last commit
* MFC exec_shell() package related function
* MFC exec_php() package related function
-rwxr-xr-x | usr/local/www/xmlrpc.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index dad5f3e..564d58d 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -67,6 +67,53 @@ $XML_RPC_erruser = 200; /* EXPOSED FUNCTIONS */ +$exec_php_doc = 'XMLRPC wrapper for eval(). This method must be called with two parameters: a string containing the local system\'s password followed by the PHP code to evaluate.'; +$exec_php_sig = array( + array( + $XML_RPC_Boolean, // First signature element is return value. + $XML_RPC_String, // password + $XML_RPC_String, // shell code to exec + ) + ); + + +function exec_php_xmlrpc($raw_params) { + global $config, $xmlrpc_g; + $params = xmlrpc_params_to_php($raw_params); + if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail']; + $exec_php = $params[0]; + eval($exec_php); + return $xmlrpc_g['return']['true']; +} + + + +/*****************************/ + + +$exec_shell_doc = 'XMLRPC wrapper for mwexec(). This method must be called with two parameters: a string containing the local system\'s password followed by an shell command to execute.'; +$exec_shell_sig = array( + array( + $XML_RPC_Boolean, // First signature element is return value. + $XML_RPC_String, // password + $XML_RPC_String, // shell code to exec + ) + ); + + +function exec_shell_xmlrpc($raw_params) { + global $config, $xmlrpc_g; + $params = xmlrpc_params_to_php($raw_params); + if(!xmlrpc_auth($params)) return $xmlrpc_g['return']['authfail']; + $shell_cmd = $params[0]; + mwexec($shell_cmd); + return $xmlrpc_g['return']['true']; +} + + + +/*****************************/ + $backup_config_section_doc = 'XMLRPC wrapper for backup_config_section. This method must be called with two parameters: a string containing the local system\'s password followed by an array containing the keys to be backed up.'; $backup_config_section_sig = array( array( @@ -246,6 +293,12 @@ function interfaces_carp_configure_xmlrpc($raw_params) { $server = new XML_RPC_Server( array( + 'pfsense.exec_shell' => array('function' => 'exec_shell_xmlrpc', + 'signature' => $exec_shell_sig, + 'docstring' => $exec_shell_doc), + 'pfsense.exec_php' => array('function' => 'exec_php_xmlrpc', + 'signature' => $exec_php_sig, + 'docstring' => $exec_php_doc), 'pfsense.interfaces_carp_configure' => array('function' => 'interfaces_carp_configure_xmlrpc', 'signature' => $carp_configure_doc, 'docstring' => $carp_configure_sig), @@ -261,6 +314,11 @@ $server = new XML_RPC_Server( 'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc', 'signature' => $merge_config_section_sig, 'docstring' => $merge_config_section_doc), + + 'pfsense.merge_installedpackages_section_xmlrpc' => array('function' => 'merge_installedpackages_section_xmlrpc', + 'signature' => $merge_config_section_sig, + 'docstring' => $merge_config_section_doc), + 'pfsense.filter_configure' => array('function' => 'filter_configure_xmlrpc', 'signature' => $filter_configure_sig, 'docstring' => $filter_configure_doc), |