Commit a7d3d67f authored by sikeda's avatar sikeda
Browse files

[-dev] tools::md5_fingerprint() was deprecated. Use Digest::MD5::md5_hex() directly.

git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11374 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 88ec2caa
...@@ -49,6 +49,7 @@ use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--'; ...@@ -49,6 +49,7 @@ use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
use Archive::Zip qw(); use Archive::Zip qw();
use DateTime; use DateTime;
use DateTime::Format::Mail; use DateTime::Format::Mail;
use Digest::MD5;
use Encode qw(); use Encode qw();
use English; # FIXME: drop $MATCH usage use English; # FIXME: drop $MATCH usage
use MIME::EncWords; use MIME::EncWords;
...@@ -21185,7 +21186,7 @@ sub do_upload_pictures { ...@@ -21185,7 +21186,7 @@ sub do_upload_pictures {
return 'suboptions'; return 'suboptions';
} }
   
my $filename = tools::md5_fingerprint($param->{'user'}{'email'}); my $filename = Digest::MD5::md5_hex($param->{'user'}{'email'});
my $fullfilename = $filename . '.' . $filetype; my $fullfilename = $filename . '.' . $filetype;
   
my @filetmp; my @filetmp;
......
...@@ -26,6 +26,7 @@ package Sympa::Auth; ...@@ -26,6 +26,7 @@ package Sympa::Auth;
use strict; use strict;
use warnings; use warnings;
use Digest::MD5;
use POSIX qw(); use POSIX qw();
use Conf; use Conf;
...@@ -48,9 +49,9 @@ sub password_fingerprint { ...@@ -48,9 +49,9 @@ sub password_fingerprint {
my $pwd = shift; my $pwd = shift;
if (Conf::get_robot_conf('*', 'password_case') eq 'insensitive') { if (Conf::get_robot_conf('*', 'password_case') eq 'insensitive') {
return tools::md5_fingerprint(lc($pwd)); return Digest::MD5::md5_hex(lc($pwd));
} else { } else {
return tools::md5_fingerprint($pwd); return Digest::MD5::md5_hex($pwd);
} }
} }
...@@ -410,7 +411,7 @@ sub remote_app_check_password { ...@@ -410,7 +411,7 @@ sub remote_app_check_password {
my ($trusted_application_name, $password, $robot) = @_; my ($trusted_application_name, $password, $robot) = @_;
Log::do_log('debug', '(%s, %s)', $trusted_application_name, $robot); Log::do_log('debug', '(%s, %s)', $trusted_application_name, $robot);
my $md5 = tools::md5_fingerprint($password); my $md5 = Digest::MD5::md5_hex($password);
my $vars; my $vars;
# seach entry for trusted_application in Conf # seach entry for trusted_application in Conf
......
...@@ -26,6 +26,7 @@ package Sympa::Bulk; ...@@ -26,6 +26,7 @@ package Sympa::Bulk;
use strict; use strict;
use warnings; use warnings;
use Digest::MD5;
use MIME::Base64 qw(); use MIME::Base64 qw();
use MIME::Parser; use MIME::Parser;
use Term::ProgressBar; use Term::ProgressBar;
...@@ -35,7 +36,6 @@ use Time::HiRes qw(); ...@@ -35,7 +36,6 @@ use Time::HiRes qw();
use Conf; use Conf;
use Log; use Log;
use SDM; use SDM;
use tools;
use Sympa::Tools::Daemon; use Sympa::Tools::Daemon;
## Database and SQL statement handlers ## Database and SQL statement handlers
...@@ -290,7 +290,7 @@ sub store { ...@@ -290,7 +290,7 @@ sub store {
##-----------------------------## ##-----------------------------##
my $msg = MIME::Base64::encode($message->to_string); my $msg = MIME::Base64::encode($message->to_string);
my $messagekey = tools::md5_fingerprint($msg); my $messagekey = Digest::MD5::md5_hex($msg);
# first store the message in bulk_spool_table # first store the message in bulk_spool_table
# because as soon as packet are created bulk.pl may distribute them # because as soon as packet are created bulk.pl may distribute them
...@@ -394,7 +394,7 @@ sub store { ...@@ -394,7 +394,7 @@ sub store {
} else { } else {
$rcptasstring = $packet; $rcptasstring = $packet;
} }
my $packetid = tools::md5_fingerprint($rcptasstring); my $packetid = Digest::MD5::md5_hex($rcptasstring);
my $packet_already_exist; my $packet_already_exist;
if ($message_already_on_spool) { if ($message_already_on_spool) {
## search if this packet is already in spool database : mailfile ## search if this packet is already in spool database : mailfile
...@@ -635,7 +635,7 @@ sub store_test { ...@@ -635,7 +635,7 @@ sub store_test {
); );
$priority_message = 9; $priority_message = 9;
my $messagekey = tools::md5_fingerprint(Time::HiRes::time()); my $messagekey = Digest::MD5::md5_hex(Time::HiRes::time());
my $msg = ''; my $msg = '';
$progress->max_update_rate(1); $progress->max_update_rate(1);
my $next_update = 0; my $next_update = 0;
......
...@@ -3491,7 +3491,7 @@ sub find_picture_filenames { ...@@ -3491,7 +3491,7 @@ sub find_picture_filenames {
my $self = shift; my $self = shift;
my $email = shift; my $email = shift;
my $login = tools::md5_fingerprint($email); my $login = Digest::MD5::md5_hex($email);
my @ret = (); my @ret = ();
foreach my $ext (qw{gif jpg jpeg png}) { foreach my $ext (qw{gif jpg jpeg png}) {
...@@ -5367,7 +5367,7 @@ sub update_list_member { ...@@ -5367,7 +5367,7 @@ sub update_list_member {
foreach my $path ($self->find_picture_paths($who)) { foreach my $path ($self->find_picture_paths($who)) {
my $extension = [reverse split /\./, $path]->[0]; my $extension = [reverse split /\./, $path]->[0];
my $new_path = $self->get_picture_path( my $new_path = $self->get_picture_path(
tools::md5_fingerprint($values->{'email'}) . '.' Digest::MD5::md5_hex($values->{'email'}) . '.'
. $extension); . $extension);
unless (rename $path, $new_path) { unless (rename $path, $new_path) {
Log::do_log('err', 'Failed to rename %s to %s : %m', Log::do_log('err', 'Failed to rename %s to %s : %m',
......
...@@ -1500,30 +1500,8 @@ sub add_in_blacklist { ...@@ -1500,30 +1500,8 @@ sub add_in_blacklist {
# DEPRECATED: No longer used. # DEPRECATED: No longer used.
# sub get_fingerprint($email, $fingerprint); # sub get_fingerprint($email, $fingerprint);
############################################################ # DEPRECATED: Use Digest::MD5::md5_hex.
# md5_fingerprint # #sub md5_fingerprint($input_string);
############################################################
# The algorithm MD5 (Message Digest 5) is a cryptographic #
# hash function which permit to obtain #
# the fingerprint of a file/data #
# #
# IN : a string #
# #
# OUT : md5 digest #
# | undef #
# #
############################################################
sub md5_fingerprint {
my $input_string = shift;
return undef unless (defined $input_string);
chomp $input_string;
my $digestmd5 = Digest::MD5->new;
$digestmd5->reset;
$digestmd5->add($input_string);
return (unpack("H*", $digestmd5->digest));
}
# DEPRECATED: No longer used. # DEPRECATED: No longer used.
# sub get_db_random(); # sub get_db_random();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--'; use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
use strict; use strict;
use warnings; use warnings;
use Digest::MD5;
use English qw(-no_match_vars); use English qw(-no_match_vars);
use File::Copy qw(); use File::Copy qw();
use Getopt::Long; use Getopt::Long;
...@@ -606,7 +607,7 @@ while ($signal ne 'term') { #as long as a signal is not received } ...@@ -606,7 +607,7 @@ while ($signal ne 'term') { #as long as a signal is not received }
} }
exit 0; exit 0;
} elsif ($main::options{'md5_digest'}) { } elsif ($main::options{'md5_digest'}) {
my $md5 = tools::md5_fingerprint($main::options{'md5_digest'}); my $md5 = Digest::MD5::md5_hex($main::options{'md5_digest'});
printf "md5 digest : $md5 \n"; printf "md5 digest : $md5 \n";
exit 0; exit 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment