mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 13:30:25 +02:00
[feature/passwords] Increase test coverage to 35 out ouf 36 methods
Only one small code part in the salted md5 driver can't be tested right now. Passwords helper and passwords driver helper are now fully covered by tests. PHPBB3-11610
This commit is contained in:
@@ -120,12 +120,13 @@ class helper
|
||||
* Get random salt with specified length
|
||||
*
|
||||
* @param int $length Salt length
|
||||
* @param string $rand_seed Seed for random data (optional). For tests.
|
||||
*/
|
||||
public function get_random_salt($length)
|
||||
public function get_random_salt($length, $rand_seed = '/dev/urandom')
|
||||
{
|
||||
$random = '';
|
||||
|
||||
if (($fh = @fopen('/dev/urandom', 'rb')))
|
||||
if (($fh = @fopen($rand_seed, 'rb')))
|
||||
{
|
||||
$random = fread($fh, $length);
|
||||
fclose($fh);
|
||||
|
@@ -46,10 +46,7 @@ class salted_md5 extends \phpbb\passwords\driver\base
|
||||
}
|
||||
else
|
||||
{
|
||||
if (($settings = $this->get_hash_settings($this->generate_salt())) === false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$settings = $this->get_hash_settings($this->generate_salt());
|
||||
}
|
||||
|
||||
$hash = md5($settings['salt'] . $password, true);
|
||||
|
Reference in New Issue
Block a user