line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# <@LICENSE> |
2
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more |
3
|
|
|
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with |
4
|
|
|
|
|
|
|
# this work for additional information regarding copyright ownership. |
5
|
|
|
|
|
|
|
# The ASF licenses this file to you under the Apache License, Version 2.0 |
6
|
|
|
|
|
|
|
# (the "License"); you may not use this file except in compliance with |
7
|
|
|
|
|
|
|
# the License. You may obtain a copy of the License at: |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
12
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
13
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
15
|
|
|
|
|
|
|
# limitations under the License. |
16
|
|
|
|
|
|
|
# </@LICENSE> |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Mail::SpamAssassin::Locker; |
19
|
|
|
|
|
|
|
|
20
|
26
|
|
|
26
|
|
165
|
use strict; |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
691
|
|
21
|
26
|
|
|
26
|
|
127
|
use warnings; |
|
26
|
|
|
|
|
46
|
|
|
26
|
|
|
|
|
636
|
|
22
|
|
|
|
|
|
|
# use bytes; |
23
|
26
|
|
|
26
|
|
148
|
use re 'taint'; |
|
26
|
|
|
|
|
44
|
|
|
26
|
|
|
|
|
818
|
|
24
|
26
|
|
|
26
|
|
161
|
use Fcntl; |
|
26
|
|
|
|
|
43
|
|
|
26
|
|
|
|
|
9319
|
|
25
|
26
|
|
|
26
|
|
188
|
use Time::HiRes (); |
|
26
|
|
|
|
|
44
|
|
|
26
|
|
|
|
|
441
|
|
26
|
|
|
|
|
|
|
|
27
|
26
|
|
|
26
|
|
115
|
use Mail::SpamAssassin; |
|
26
|
|
|
|
|
45
|
|
|
26
|
|
|
|
|
5675
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @ISA = qw(); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
########################################################################### |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub new { |
34
|
81
|
|
|
81
|
0
|
213
|
my $class = shift; |
35
|
81
|
|
33
|
|
|
605
|
$class = ref($class) || $class; |
36
|
81
|
|
|
|
|
251
|
my $self = { }; |
37
|
81
|
|
|
|
|
202
|
bless ($self, $class); |
38
|
81
|
|
|
|
|
254
|
$self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
########################################################################### |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub safe_lock { |
44
|
0
|
|
|
0
|
0
|
|
my ($self, $path, $max_retries, $mode) = @_; |
45
|
|
|
|
|
|
|
# max_retries is optional, should default to about 30 |
46
|
|
|
|
|
|
|
# mode is UNIX-style and optional, should default to 0700, |
47
|
|
|
|
|
|
|
# callers must specify --x bits |
48
|
0
|
|
|
|
|
|
die "locker: safe_lock not implemented by Locker subclass"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
########################################################################### |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub safe_unlock { |
54
|
0
|
|
|
0
|
0
|
|
my ($self, $path) = @_; |
55
|
0
|
|
|
|
|
|
die "locker: safe_unlock not implemented by Locker subclass"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
########################################################################### |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub refresh_lock { |
61
|
0
|
|
|
0
|
0
|
|
my ($self, $path) = @_; |
62
|
0
|
|
|
|
|
|
die "locker: refresh_lock not implemented by Locker subclass"; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
########################################################################### |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub jittery_one_second_sleep { |
68
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
69
|
0
|
|
|
|
|
|
Time::HiRes::sleep(rand(1.0) + 0.5); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
########################################################################### |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |