Commit 746aae5a authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Change upgrade_send_spool.pl and upgrade_sympa_password.pl to read the...

Change upgrade_send_spool.pl and upgrade_sympa_password.pl to read the obsoleted parameter "cookie" by themselves
parent e1555fc1
......@@ -58,6 +58,12 @@ unless (Conf::load(Conf::get_sympa_conf(), 'no_db')) {
die sprintf 'Configuration file %s has errors.\n', Conf::get_sympa_conf();
}
# Get obsoleted parameter.
open my $fh, '<', Conf::get_sympa_conf() or die $ERRNO;
my ($cookie) =
grep {defined} map { /\A\s*cookie\s+(\S+)/s ? $1 : undef } <$fh>;
close $fh;
# Set the User ID & Group ID for the process
$GID = $EGID = (getgrnam(Sympa::Constants::GROUP))[2];
$UID = $EUID = (getpwnam(Sympa::Constants::USER))[2];
......@@ -131,12 +137,7 @@ sub process {
sub sympa_checksum {
my $rcpt = shift;
return (
substr(
Digest::MD5::md5_hex(join('/', $Conf::Conf{'cookie'}, $rcpt)),
-10
)
);
return substr Digest::MD5::md5_hex(join '/', $cookie, $rcpt), -10;
}
__END__
......@@ -182,6 +183,8 @@ Following site configuration parameters in F<--CONFIG--> are referred.
=item cookie
(obsoleted by Sympa 6.2.61b)
=item queue
=item umask
......
......@@ -30,6 +30,7 @@ use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
use strict;
use warnings;
use Digest::MD5;
use English qw(-no_match_vars);
use Getopt::Long;
use MIME::Base64 qw();
use Time::HiRes qw(gettimeofday tv_interval);
......@@ -82,6 +83,12 @@ if ($dry_run) {
die 'Error in configuration'
unless Conf::load($config, 'no_db');
# Get obsoleted parameter.
open my $fh, '<', $config or die $ERRNO;
my ($cookie) =
grep {defined} map { /\A\s*cookie\s+(\S+)/s ? $1 : undef } <$fh>;
close $fh;
my $password_hash = Conf::get_robot_conf('*', 'password_hash');
my $bcrypt_cost = Conf::get_robot_conf('*', 'bcrypt_cost');
......@@ -274,7 +281,7 @@ sub _decrypt_rc4_password {
return $inpasswd unless $inpasswd =~ /\Acrypt[.](.*)\z/;
$inpasswd = $1;
$rc4 = Crypt::CipherSaber->new($Conf::Conf{'cookie'}) unless $rc4;
$rc4 = Crypt::CipherSaber->new($cookie) unless $rc4;
return $rc4->decrypt(MIME::Base64::decode($inpasswd));
}
......
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