diff options
author | Colin Smith <colin@pfsense.org> | 2005-06-07 03:22:43 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-06-07 03:22:43 +0000 |
commit | bd0fe65b1b118d36b3a6061b78a3fc3950a14e11 (patch) | |
tree | f17082f0c076706e5e07e0e41335ca5cdc9f8073 | |
parent | c501c39ffbef8204d1df2a8d77a56d17339b331e (diff) | |
download | pfsense-bd0fe65b1b118d36b3a6061b78a3fc3950a14e11.zip pfsense-bd0fe65b1b118d36b3a6061b78a3fc3950a14e11.tar.gz |
Add RPC wrapper to rc.reboot. This method requires password authentication.
-rwxr-xr-x | usr/local/www/xmlrpc.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/usr/local/www/xmlrpc.php b/usr/local/www/xmlrpc.php index 7e28e2d..13fb1c6 100755 --- a/usr/local/www/xmlrpc.php +++ b/usr/local/www/xmlrpc.php @@ -97,6 +97,16 @@ function auto_update_xmlrpc($raw_params) { return new XML_RPC_Response(new XML_RPC_Value(true, 'boolean')); } +$reboot_doc = 'Basic XMLRPC wrapper for rc.reboot.'; +$reboot_sig = array(array(boolean, string)); + +function reboot_xmlrpc($raw_params) { + $params = xmlrpc_params_to_php($raw_params); + if(!xmlrpc_auth($params)) return new XML_RPC_Response(new XML_RPC_Value("auth_failure", 'string')); + exec("/etc/rc.reboot &"); + return new XML_RPC_Response(new XML_RPC_Value(true, 'boolean')); +} + $server = new XML_RPC_Server( array( 'pfsense.backup_config_section' => array('function' => 'backup_config_section_xmlrpc', @@ -110,10 +120,13 @@ $server = new XML_RPC_Server( 'docstring' => $filter_configure_doc), 'pfsense.check_firmware_version' => array('function' => 'check_firmware_version_xmlrpc', 'signature' => $check_firmware_version_sig, - 'docstring' => $check_firmware_version_doc) + 'docstring' => $check_firmware_version_doc), // 'pfsense.auto_update' => array('function' => 'auto_update_xmlrpc', // 'signature' => $auto_update_sig, -// 'docstring' => $auto_update_doc) +// 'docstring' => $auto_update_doc), + 'pfsense.reboot' => array('function' => 'reboot_xmlrpc', + 'signature' => $reboot_sig, + 'docstring' => $reboot_doc) ) ); ?> |