Skip to content

Commit

Permalink
Implement MasterSaltInvalid exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Dec 18, 2011
1 parent 7c696c6 commit 2dac13a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/Security/MasterSaltInvalid.php
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Security;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class MasterSaltInvalid extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_CRYPTO_MASTER_SALT_INVALID, null, false);
parent::__construct(ERROR_CRYPTO_MASTER_SALT_INVALID, $errorMessage, null);
$this->responseCode = 500;
}
}
5 changes: 2 additions & 3 deletions application/core/crypto_api.php
Expand Up @@ -25,15 +25,14 @@
*
* @uses config_api.php
* @uses constant_inc.php
* @uses error_api.php
* @uses utility_api.php
*/

use MantisBT\Exception\Security\CSPRNGNotAvailable;
use MantisBT\Exception\Security\MasterSaltInvalid;

require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'error_api.php' );
require_api( 'utility_api.php' );

/**
Expand All @@ -46,7 +45,7 @@
function crypto_init() {
if ( !defined( 'MANTIS_MAINTENANCE_MODE' ) ) {
if ( strlen( config_get_global( 'crypto_master_salt' ) ) < 16 ) {
trigger_error( ERROR_CRYPTO_MASTER_SALT_INVALID, ERROR );
throw new MasterSaltInvalid();
}
}
return;
Expand Down

0 comments on commit 2dac13a

Please sign in to comment.