summaryrefslogtreecommitdiff
path: root/lib/JWebmail/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail/Plugin')
-rw-r--r--lib/JWebmail/Plugin/Helper.pm5
-rw-r--r--lib/JWebmail/Plugin/INIConfig.pm2
-rw-r--r--lib/JWebmail/Plugin/ServerSideSessionData.pm18
3 files changed, 13 insertions, 12 deletions
diff --git a/lib/JWebmail/Plugin/Helper.pm b/lib/JWebmail/Plugin/Helper.pm
index 8323a61..ad5c8ad 100644
--- a/lib/JWebmail/Plugin/Helper.pm
+++ b/lib/JWebmail/Plugin/Helper.pm
@@ -178,8 +178,9 @@ sub session_passwd {
if (length $passwd < 20) {
$passwd .= "\n" . ' ' x (20 - length($passwd) - 1);
}
- my $rand_bytes = _rand_data(length $passwd);
- $c->s3d(S_PASSWD, b64_encode(encode('UTF-8', $passwd) ^ $rand_bytes, ''));
+ my $passwd_utf8 = encode('UTF-8', $passwd);
+ my $rand_bytes = _rand_data(length $passwd_utf8);
+ $c->s3d(S_PASSWD, b64_encode($passwd_utf8 ^ $rand_bytes, ''));
$c->session(S_OTP_S3D_PW, b64_encode($rand_bytes, ''));
}
else {
diff --git a/lib/JWebmail/Plugin/INIConfig.pm b/lib/JWebmail/Plugin/INIConfig.pm
index be9841e..08e1ef1 100644
--- a/lib/JWebmail/Plugin/INIConfig.pm
+++ b/lib/JWebmail/Plugin/INIConfig.pm
@@ -9,7 +9,7 @@ use Config::Tiny;
sub parse {
my ($self, $content, $file, $conf, $_app) = @_;
- my $ct = Config::Tiny->new;
+ my $ct = Config::Tiny->new();
my $config = $ct->read_string($content, 'utf8');
die qq{Can't parse config "$file": } . $ct->errstr unless defined $config;
diff --git a/lib/JWebmail/Plugin/ServerSideSessionData.pm b/lib/JWebmail/Plugin/ServerSideSessionData.pm
index 94e8f25..c28f6d1 100644
--- a/lib/JWebmail/Plugin/ServerSideSessionData.pm
+++ b/lib/JWebmail/Plugin/ServerSideSessionData.pm
@@ -42,7 +42,7 @@ sub _rw_cleanup_file {
close $lock;
chomp $pid;
if (!$rmlock && (!$pid || !-e "/proc/$pid")) {
- $lock_name->remove;
+ $lock_name->remove();
$rmlock = 1;
next;
}
@@ -60,7 +60,7 @@ sub _rw_cleanup_file {
use autodie;
open(my $info, -e $info_name ? '+<' : '+>', $info_name);
- my $next_time = $info->getline // '';
+ my $next_time = $info->getline() // '';
$next_time = 0 unless $next_time =~ /^\d+$/a;
chomp $next_time;
if ($next_time > $time) {
@@ -77,7 +77,7 @@ sub _rw_cleanup_file {
return 1;
}
};
- $lock_name->remove;
+ $lock_name->remove();
return $ret;
}
@@ -89,7 +89,7 @@ sub cleanup_files {
if ($self->_next_cleanup < $t && $self->_rw_cleanup_file($t)) {
for ($self->session_directory->list->each) {
if ( $_->stat->mtime + $self->expiration < $t ) {
- $_->remove;
+ $_->remove();
}
}
}
@@ -102,7 +102,7 @@ sub s3d {
my ($key, $val) = @_;
# cleanup old sessions
- $self->cleanup_files;
+ $self->cleanup_files();
my $file = $self->session_directory->child($c->session(S_KEY) || $c->req->request_id . $$);
@@ -111,16 +111,16 @@ sub s3d {
truncate $file, 0;
}
else {
- $file->touch;
+ $file->touch();
}
}
elsif (defined $val) {
- $file->touch;
+ $file->touch();
$file->chmod(0600);
$c->session(S_KEY, $file->basename);
}
- my $data = -s $file ? decode_json($file->slurp) : {};
+ my $data = -s $file ? decode_json($file->slurp()) : {};
if (defined $val) { # set
$data->{$key} = $val;
@@ -147,7 +147,7 @@ sub register {
or $! ? die "failed to create directory: $!" : 1;
}
- $self->cleanup_files;
+ $self->cleanup_files();
$app->helper( s3d => sub { $self->s3d(@_) } );
$app->helper( s3d_close => sub { delete shift->session->{S_KEY()} } );