Migrate from libdigest to crypt-eks-blowfish due to notice

This commit is contained in:
Pliable Pixels 2019-05-16 09:37:11 -04:00
parent a07da01f0c
commit 0e72080c4a
2 changed files with 7 additions and 8 deletions

View File

@ -27,7 +27,7 @@ Build-Depends: debhelper (>= 9), cmake
, libsys-cpu-perl, libsys-meminfo-perl
, libdata-uuid-perl
, libssl-dev
, libdigest-bcrypt-perl, libdata-entropy-perl
, libcrypt-eksblowfish-perl, libdata-entropy-perl
Standards-Version: 3.9.4
Package: zoneminder
@ -54,7 +54,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
, libvlccore5 | libvlccore7 | libvlccore8, libvlc5
, libpolkit-gobject-1-0, php5-gd
, libssl
,libdigest-bcrypt-perl, libdata-entropy-perl
,libcrypt-eksblowfish-perl, libdata-entropy-perl
Recommends: mysql-server | mariadb-server
Description: Video camera security and surveillance solution

View File

@ -51,7 +51,7 @@ configuring upgrades etc, including on the fly upgrades.
use strict;
use bytes;
use version;
use Digest;
use Crypt::Eksblowfish::Bcrypt;
use Data::Entropy::Algorithms qw(rand_bits);
# ==========================================================================
@ -1011,11 +1011,10 @@ sub migratePasswords {
my $scheme = substr($user->{Password}, 0, 1);
if ($scheme eq "*") {
print ("-->".$user->{Username}. " password will be migrated\n");
my $bcrypt = Digest->new('Bcrypt', cost=>10, salt=>rand_bits(16*8));
my $settings = $bcrypt->settings();
my $pass_hash = $bcrypt->add($user->{Password})->bcrypt_b64digest;
#print ("--- New pass overlay ----".$pass_hash);
my $new_pass_hash = "-ZM-".$settings.$pass_hash;
my $salt = Crypt::Eksblowfish::Bcrypt::en_base64(rand_bits(16*8));
my $settings = '$2a$10$'.$salt;
my $pass_hash = Crypt::Eksblowfish::Bcrypt::bcrypt($user->{Password},$settings);
my $new_pass_hash = "-ZM-".$pass_hash;
$sql = "UPDATE Users SET PASSWORD=? WHERE Username=?";
my $sth = $dbh->prepare_cached( $sql ) or die( "Can't prepare '$sql': ".$dbh->errstr() );
my $res = $sth->execute($new_pass_hash, $user->{Username}) or die( "Can't execute: ".$sth->errstr() );