Merge branch 'master' of git.beeznest.com:minedu-chamilo

skala
Julio Montoya 12 years ago
commit f50bcbdd3f
  1. 2
      src/ChamiloLMS/Transaction/Envelope.php
  2. 2
      src/ChamiloLMS/Transaction/Plugin/SslSignedJsonWrapper.php
  3. 11
      src/ChamiloLMS/Transaction/TransactionLogController.php

@ -160,7 +160,7 @@ class Envelope
*
* @return array
* An array with the metadata. Contains the following keys:
* - 'type': The wrapper plugin machine name.
* - 'blob_type': The wrapper plugin machine name.
* - 'origin_branch_id': The branch where the blob was generated.
*/
public static function identifyBlobMetadata($blob) {

@ -192,7 +192,7 @@ class SslSignedJsonWrapper extends JsonWrapper
throw new UnwrapException(self::format_log(sprintf('Problem veryfing signer branch: %s.', $exception->getMessage())));
}
if (!$declared_branch_is_valid) {
$message = sprintf('Declared branch with id "%d" is not the same than real signer branch. Possible attack attempt to inject transactions with other valid branch signature.', $branch->getId());
$message = sprintf('Declared branch with id "%d" is not the same than real signer branch. Possible attack attempt to inject transactions with other valid branch signature.', $declared_origin_branch->getId());
// Try to identify it.
if (!$branch_id = $this->identifySignerBranch($envelope_metadata['origin_branch_id'], $signer_certificates_file)) {
$message .= sprintf(' Cannot retrieve any valid branch associated with the signer certificate file "%s". Altered data?', $signer_certificates_file);

@ -172,7 +172,7 @@ class TransactionLogController
* An array keyed by received envelope id containing an array transaction
* ids added based on that received envelope.
*/
public static function importPendingEnvelopes($limit = 0) {
public function importPendingEnvelopes($limit = 0) {
$table = Database::get_main_table(TABLE_RECEIVED_ENVELOPES);
$log_entry = array('log_type' => self::LOG_IMPORT_TO_TX_QUEUE);
// Sadly limit clause is not supported by Database::select().
@ -188,8 +188,8 @@ class TransactionLogController
try {
$blob_metadata = Envelope::identifyBlobMetadata($row['data']);
$origin_branch = $this->branchRepository->find($blob_metadata['origin_branch_id']);
$wrapper_plugin = self::createPlugin('wrapper', $blob_metadata['type'], $origin_branch->getPluginData('wrapper'));
$envelope_data = array('blob' => $blob, 'origin_branch_id' => $blob_metadata['origin_branch_id']);
$wrapper_plugin = self::createPlugin('wrapper', $blob_metadata['blob_type'], $origin_branch->getPluginData('wrapper'));
$envelope_data = array('blob' => $row['data'], 'origin_branch_id' => $blob_metadata['origin_branch_id']);
$envelope = new Envelope($wrapper_plugin, $envelope_data);
$envelope->unwrap();
$transactions = $envelope->getTransactions();
@ -567,7 +567,10 @@ class TransactionLogController
try {
$blob_metadata = Envelope::identifyBlobMetadata($blob);
$origin_branch = $this->branchRepository->find($blob_metadata['origin_branch_id']);
$wrapper_plugin = self::createPlugin('wrapper', $blob_metadata['type'], $origin_branch->getPluginData('wrapper'));
if (!$origin_branch) {
throw new Exception(sprintf('Cannot find a local branch with id %s', $blob_metadata['origin_branch_id']));
}
$wrapper_plugin = self::createPlugin('wrapper', $blob_metadata['blob_type'], $origin_branch->getPluginData('wrapper'));
$envelope_data = array('blob' => $blob, 'origin_branch_id' => $blob_metadata['origin_branch_id']);
$envelope = new Envelope($wrapper_plugin, $envelope_data);
}

Loading…
Cancel
Save