diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-02-14 04:57:26 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-02-14 04:57:26 +0000 |
commit | c3638879b2639f0e1f08c7eda0f533632f8cdec5 (patch) | |
tree | 9a413bed69bf00766c24ffe0e742fb555b0d43e5 /usr | |
parent | 82ae5cfc97ea6dcd5b98095d272364cf007a78cd (diff) | |
download | pfsense-c3638879b2639f0e1f08c7eda0f533632f8cdec5.zip pfsense-c3638879b2639f0e1f08c7eda0f533632f8cdec5.tar.gz |
* Add xmlrpc declarations missed in last commit
* MFC exec_shell() package related function
* MFC exec_php() package related function
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/xmlrpc.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index a469910..5bb6e2f 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -67,6 +67,54 @@ $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 +294,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), @@ -258,6 +312,9 @@ $server = new XML_RPC_Server( 'pfsense.merge_config_section' => array('function' => 'merge_config_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), |