function _drd_server_validate_request in Drupal Remote Dashboard Server 7.2
Same name and namespace in other branches
- 6.2 drd_server.module \_drd_server_validate_request()
Callback to validate a request that's coming from DRD.
Parameters
array $args: An array of all arguments being submitted by DRD.
string $action_name: If the callback from DRD is about to execute an action, this parameter determines the action name.
Return value
bool|string All unencrypted arguments are in $args and the return value is either TRUE or contains an error message.
9 calls to _drd_server_validate_request()
- drd_server_config_domain_read in ./
drd_server.module - Callback to retrieve a (sub-)form for Domain configuration.
- drd_server_config_domain_save in ./
drd_server.module - Callback to save Domain configuration.
- drd_server_config_server_read in ./
drd_server.module - Callback to retrieve a (sub-)form for Core configuration.
- drd_server_config_server_save in ./
drd_server.module - Callback to save Core configuration.
- drd_server_execute in ./
drd_server.module - This is called to execute one of the actions that are defined on one of the hook_drd_server_actions().
File
- ./
drd_server.module, line 1121 - Provides XMLRPC implementation to respond to requests from DRD.
Code
function _drd_server_validate_request(&$args, $action_name = '') {
$langcode = $args[2];
$debug = $args[3];
global $language;
$language->language = $langcode;
_drd_server_debug_mode($debug);
$aes = drd_server_aes();
if (empty($aes)) {
_drd_server_watchdog('Execution request unauthorized.', array(), WATCHDOG_ALERT);
return drd_server_error(t('Referer (%ip) not allowed.', array(
'%ip' => ip_address(),
)), DRD_SERVER_ERROR_WRONG_REFERER);
}
array_push($args, $action_name);
$iv = _drd_server_iv();
foreach ($args as $i => $value) {
if (!empty($value) && !in_array($i, array(
2,
3,
))) {
$args[$i] = drd_server_aes_decrypt($value, TRUE, $aes['key'], $aes['cipher'], $iv, $aes['impl']);
}
}
$api = array_shift($args);
$timestamp = array_shift($args);
$langcode = array_shift($args);
$debug = array_shift($args);
if (!_drd_server_validate_timestamp($timestamp)) {
_drd_server_watchdog('Wrong encryption keys.', array(), WATCHDOG_EMERGENCY);
return drd_server_error(t('Wrong encryption keys.'), DRD_SERVER_ERROR_WRONG_KEYS);
}
if ($api !== DRD_SERVER_API_VERSION) {
_drd_server_watchdog('Wrong API: %api.', array(
'%api' => $api,
), WATCHDOG_ALERT);
return drd_server_error(t('Wrong API.'), DRD_SERVER_ERROR_WRONG_API);
}
$action_name = empty($args[0]) ? t('simple') : $args[0];
if (sizeof($args) < 2) {
_drd_server_watchdog('Remote execution request: !action_name', array(
'!action_name' => $action_name,
));
}
else {
_drd_server_watchdog('Remote execution request: !action_name <pre>!args</pre>', array(
'!action_name' => $action_name,
'!args' => print_r($args, TRUE),
));
}
return TRUE;
}