phpBB

Code Changes

File: phpbb/passwords/manager.php

  Unmodified   Added   Modified   Removed
Line 48Line 48
	* @var \phpbb\config\config
*/
protected $config;

	* @var \phpbb\config\config
*/
protected $config;

 

/**
* @var bool Whether or not initialized() has been called
*/
private $initialized = false;

/**
* @var array Hashing driver service collection
*/
private $hashing_algorithms;

/**
* @var array List of default driver types
*/
private $defaults;


/**
* Construct a passwords object
*


/**
* Construct a passwords object
*

	* @param \phpbb\config\config $config phpBB configuration
* @param array $hashing_algorithms Hashing driver
* service collection
* @param \phpbb\passwords\helper $helper Passwords helper object
* @param string $defaults List of default driver types

	* @param \phpbb\config\config		$config				phpBB configuration
* @param array $hashing_algorithms Hashing driver service collection
* @param \phpbb\passwords\helper $helper Passwords helper object
* @param array $defaults List of default driver types


	*/
public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults)
{
$this->config = $config;
$this->helper = $helper;

	*/
public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults)
{
$this->config = $config;
$this->helper = $helper;

 
		$this->hashing_algorithms = $hashing_algorithms;
$this->defaults = $defaults;
}





		$this->fill_type_map($hashing_algorithms);
$this->register_default_type($defaults);










	/**
* Initialize the internal state
*/
protected function initialize()
{
if (!$this->initialized)
{
$this->initialized = true;
$this->fill_type_map($this->hashing_algorithms);
$this->register_default_type($this->defaults);
}

	}

/**

	}

/**

Line 143Line 169
		{
return false;
}

		{
return false;
}

 

$this->initialize();


// Be on the lookout for multiple hashing algorithms
// 2 is correct: H\2a > 2, H\P > 2


// Be on the lookout for multiple hashing algorithms
// 2 is correct: H\2a > 2, H\P > 2

		if (strlen($match[1]) > 2)

		if (strlen($match[1]) > 2 && strpos($match[1], '\\') !== false)

		{
$hash_types = explode('\\', $match[1]);
$return_ary = array();

		{
$hash_types = explode('\\', $match[1]);
$return_ary = array();

Line 191Line 219
			// and not let the server try to hash it.
return false;
}

			// and not let the server try to hash it.
return false;
}

 

$this->initialize();


// Try to retrieve algorithm by service name if type doesn't
// start with dollar sign


// Try to retrieve algorithm by service name if type doesn't
// start with dollar sign

Line 241Line 271
		{
return false;
}

		{
return false;
}

 

$this->initialize();


// First find out what kind of hash we're dealing with
$stored_hash_type = $this->detect_algorithm($hash);


// First find out what kind of hash we're dealing with
$stored_hash_type = $this->detect_algorithm($hash);

Line 262Line 294
		if ($stored_hash_type->get_prefix() !== $this->type)
{
$this->convert_flag = true;

		if ($stored_hash_type->get_prefix() !== $this->type)
{
$this->convert_flag = true;

 
		}
else
{
if ($stored_hash_type instanceof driver\rehashable_driver_interface)
{
$this->convert_flag = $stored_hash_type->needs_rehash($hash);

		}
else
{
$this->convert_flag = false;

		}
else
{
$this->convert_flag = false;

 
			}

		}

// Check all legacy hash types if prefix is $CP$

		}

// Check all legacy hash types if prefix is $CP$

Line 297Line 336
	*/
public function combined_hash_password($password_hash, $type)
{

	*/
public function combined_hash_password($password_hash, $type)
{

 
		$this->initialize();


		$data = array(
'prefix' => '$',
'settings' => '$',

		$data = array(
'prefix' => '$',
'settings' => '$',