Merge branch 'MDL-51162-master' of git://github.com/lameze/moodle

This commit is contained in:
Andrew Nicols 2015-10-20 10:48:14 +08:00
commit dc2091c87f
3 changed files with 9 additions and 14 deletions

View File

@ -32,7 +32,7 @@ if ($action == 'logout' && !empty($redirect)) {
redirect($redirect);
}
} else if (!empty($HTTP_RAW_POST_DATA)) {
} else if (!file_get_contents("php://input")) {
// Back channel logout.
// Set SOAP header.

View File

@ -33,14 +33,9 @@ if ($CFG->mnet_dispatcher_mode === 'off') {
// Content type for output is not html:
header('Content-type: text/xml; charset=utf-8');
// PHP 5.2.2: $HTTP_RAW_POST_DATA not populated bug:
// http://bugs.php.net/bug.php?id=41293
if (empty($HTTP_RAW_POST_DATA)) {
$HTTP_RAW_POST_DATA = file_get_contents('php://input');
}
mnet_debug("HTTP_RAW_POST_DATA", 2);
mnet_debug($HTTP_RAW_POST_DATA, 2);
$rawpostdata = file_get_contents("php://input");
mnet_debug("RAW POST DATA", 2);
mnet_debug($rawpostdata, 2);
if (!isset($_SERVER)) {
exit(mnet_server_fault(712, get_string('phperror', 'mnet')));
@ -53,7 +48,7 @@ $remoteclient = new mnet_remote_client();
set_mnet_remote_client($remoteclient);
try {
$plaintextmessage = mnet_server_strip_encryption($HTTP_RAW_POST_DATA);
$plaintextmessage = mnet_server_strip_encryption($rawpostdata);
$xmlrpcrequest = mnet_server_strip_signature($plaintextmessage);
} catch (Exception $e) {
mnet_debug('encryption strip exception thrown: ' . $e->getMessage());

View File

@ -27,20 +27,20 @@
/* Strip encryption envelope (if present) and decrypt data
*
* @param string $HTTP_RAW_POST_DATA The XML that the client sent
* @param string $rawpostdata The XML that the client sent
*
* @throws mnet_server_exception
*
* @return string XML with any encryption envolope removed
*/
function mnet_server_strip_encryption($HTTP_RAW_POST_DATA) {
function mnet_server_strip_encryption($rawpostdata) {
$remoteclient = get_mnet_remote_client();
$crypt_parser = new mnet_encxml_parser();
$crypt_parser->parse($HTTP_RAW_POST_DATA);
$crypt_parser->parse($rawpostdata);
$mnet = get_mnet_environment();
if (!$crypt_parser->payload_encrypted) {
return $HTTP_RAW_POST_DATA;
return $rawpostdata;
}
// Make sure we know who we're talking to