You are here

function acquia_agent_valid_response in Acquia Connector 6

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent_streams.inc \acquia_agent_valid_response()
  2. 7.3 acquia_agent/acquia_agent.module \acquia_agent_valid_response()
  3. 7 acquia_agent/acquia_agent.module \acquia_agent_valid_response()
  4. 7.2 acquia_agent/acquia_agent.module \acquia_agent_valid_response()

Determine if a response from the Acquia Network is valid.

Parameters

$data: The data array returned by acquia_agent_call().

Return value

TRUE or FALSE.

1 call to acquia_agent_valid_response()
acquia_agent_check_subscription in acquia_agent/acquia_agent.module
Get subscription status from the Acquia Network, and store the result.

File

acquia_agent/acquia_agent_streams.inc, line 277
XML-RPC communication functions for Acquia communication.

Code

function acquia_agent_valid_response($data) {
  $authenticator = $data['authenticator'];
  $result = $data['result'];
  $result_auth = $result['authenticator'];
  $valid = $authenticator['nonce'] == $result_auth['nonce'];
  $valid = $valid && $authenticator['time'] < $result_auth['time'];
  $key = acquia_agent_settings('acquia_key');
  $hash = _acquia_agent_hmac($key, $result_auth['time'], $result_auth['nonce'], $result['body']);
  return $valid && $hash == $result_auth['hash'];
}