Commit ece39394 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Use encode_filesystem_safe() instead of escape_chars() for user certificates

parent b098e9e7
......@@ -1114,9 +1114,9 @@ sub smime_encrypt {
my $certfile;
my $entity;
my $base =
$Conf::Conf{'ssl_cert_dir'} . '/'
. Sympa::Tools::Text::escape_chars($email);
my $base = sprintf '%s/%s',
$Conf::Conf{'ssl_cert_dir'},
Sympa::Tools::Text::encode_filesystem_safe($email);
if (-f $base . '@enc') {
$certfile = $base . '@enc';
} else {
......@@ -1350,8 +1350,8 @@ sub check_smime_signature {
# or a pair of single-purpose. save them, as email@addr if combined,
# or as email@addr@sign / email@addr@enc for split certs.
foreach my $c (keys %certs) {
my $filename = "$Conf::Conf{ssl_cert_dir}/"
. Sympa::Tools::Text::escape_chars(lc($sender));
my $filename = sprintf '%s/%s', $Conf::Conf{ssl_cert_dir},
Sympa::Tools::Text::encode_filesystem_safe(lc $sender);
if ($c ne 'both') {
unlink $filename; # just in case there's an old cert left...
$filename .= "\@$c";
......
......@@ -2122,6 +2122,7 @@ sub upgrade {
}
if (lower_version($previous_version, '6.2.63b.1')) {
$log->syslog('notice', 'Moving bounce information and so on...');
_process_all_files(
'config',
sub {
......@@ -2161,6 +2162,25 @@ sub upgrade {
}
}
);
my $dh;
if (opendir $dh, $Conf::Conf{'ssl_cert_dir'}) {
foreach my $old (readdir $dh) {
next if 0 == index $old, '.';
my ($escaped_email, $ext) = ($old =~ /\A(.+)(?:(\@\w+)?)\z/);
my $new =
Sympa::Tools::Text::encode_filesystem_safe(
_unescape_chars($escaped_email))
. ($ext // '');
next if $old eq $new;
rename sprintf('%s/%s', $Conf::Conf{'ssl_cert_dir'}, $old),
sprintf('%s/%s', $Conf::Conf{'ssl_cert_dir'}, $new);
}
}
$log->syslog('notice', '...Done.');
}
return 1;
......
Markdown is supported
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