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::BayesStore::SDBM; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
51
|
|
21
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
63
|
|
22
|
|
|
|
|
|
|
# use bytes; |
23
|
2
|
|
|
2
|
|
11
|
use re 'taint'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
51
|
|
24
|
2
|
|
|
2
|
|
10
|
use Fcntl; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
621
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
|
691
|
use Mail::SpamAssassin::BayesStore::DBM; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
54
|
|
27
|
2
|
|
|
2
|
|
12
|
use Mail::SpamAssassin::Logger; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
526
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# our @DBNAMES; # <---- unused! |
30
|
|
|
|
|
|
|
our @ISA = qw( Mail::SpamAssassin::BayesStore::DBM ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub HAS_DBM_MODULE { |
33
|
42
|
|
|
42
|
0
|
92
|
my ($self) = @_; |
34
|
42
|
100
|
|
|
|
126
|
if (exists($self->{has_dbm_module})) { |
35
|
36
|
|
|
|
|
141
|
return $self->{has_dbm_module}; |
36
|
|
|
|
|
|
|
} |
37
|
6
|
|
|
|
|
13
|
$self->{has_dbm_module} = eval { require SDBM_File; }; |
|
6
|
|
|
|
|
68
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub DBM_MODULE { |
41
|
113
|
|
|
113
|
0
|
3007
|
return "SDBM_File"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# Possible file extensions used by the kinds of database files SDBM_File |
45
|
|
|
|
|
|
|
# might create. We need these so we can create a new file and rename |
46
|
|
|
|
|
|
|
# it into place. |
47
|
|
|
|
|
|
|
sub DB_EXTENSIONS { |
48
|
44
|
|
|
44
|
0
|
157
|
return ('.pag', '.dir'); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _unlink_file { |
52
|
0
|
|
|
0
|
|
|
my ($self, $filename) = @_; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
for my $ext ($self->DB_EXTENSIONS) { |
55
|
0
|
|
|
|
|
|
unlink $filename . $ext; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _rename_file { |
60
|
0
|
|
|
0
|
|
|
my ($self, $sourcefilename, $targetfilename) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
for my $ext ($self->DB_EXTENSIONS) { |
63
|
0
|
0
|
|
|
|
|
return 0 unless (rename($sourcefilename . $ext, $targetfilename . $ext)); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
|
|
|
|
|
return 1; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# this is called directly from sa-learn(1). |
69
|
|
|
|
|
|
|
sub perform_upgrade { |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
0
|
1
|
|
return 1; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |