line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Auth::Kokolores::Config; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
17081
|
use Moose; |
|
2
|
|
|
|
|
720787
|
|
|
2
|
|
|
|
|
13
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: configuration for Auth::Kokolores |
6
|
|
|
|
|
|
|
our $VERSION = '1.00'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11347
|
use Tie::IxHash; |
|
2
|
|
|
|
|
5616
|
|
|
2
|
|
|
|
|
58
|
|
9
|
2
|
|
|
2
|
|
1316
|
use Config::General qw(ParseConfig); |
|
2
|
|
|
|
|
33139
|
|
|
2
|
|
|
|
|
946
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'log_level' => ( is => 'rw', isa => 'Int', default => '2' ); |
12
|
|
|
|
|
|
|
has 'log_file' => ( is => 'rw', isa => 'Str', default => 'Sys::Syslog' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'syslog_ident' => ( is => 'rw', isa => 'Str', default => 'kokolores' ); |
15
|
|
|
|
|
|
|
has 'syslog_facility' => ( is => 'rw', isa => 'Str', default => 'auth' ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'socket_path' => ( is => 'rw', isa => 'Str', default => '/var/run/saslauthd/mux' ); |
18
|
|
|
|
|
|
|
has 'socket_mode' => ( is => 'rw', isa => 'Str', default => '0660' ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'user' => ( is => 'rw', isa => 'Str', default => 'nobody' ); |
21
|
|
|
|
|
|
|
has 'group' => ( is => 'rw', isa => 'Str', default => 'mail' ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# prefork engine options |
24
|
|
|
|
|
|
|
has 'min_servers' => ( is => 'rw', isa => 'Int', default => '4' ); |
25
|
|
|
|
|
|
|
has 'min_spare_servers' => ( is => 'rw', isa => 'Int', default => '4' ); |
26
|
|
|
|
|
|
|
has 'max_spare_servers' => ( is => 'rw', isa => 'Int', default => '12' ); |
27
|
|
|
|
|
|
|
has 'max_servers' => ( is => 'rw', isa => 'Int', default => '25' ); |
28
|
|
|
|
|
|
|
has 'max_requests' => ( is => 'rw', isa => 'Int', default => '1000' ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has 'satisfy' => ( is => 'rw', isa => 'Str', default => 'all' ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has 'overwrittable_attributes' => ( |
33
|
|
|
|
|
|
|
is => 'ro', isa => 'ArrayRef[Str]', default => sub { [ |
34
|
|
|
|
|
|
|
'log_level', 'log_file' |
35
|
|
|
|
|
|
|
] }, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
has 'net_server_attributes' => ( |
38
|
|
|
|
|
|
|
is => 'ro', isa => 'ArrayRef[Str]', default => sub { [ |
39
|
|
|
|
|
|
|
'syslog_ident', 'syslog_facility', 'user', 'group', |
40
|
|
|
|
|
|
|
'min_servers', 'min_spare_servers', 'max_spare_servers', 'max_servers', |
41
|
|
|
|
|
|
|
'max_requests', |
42
|
|
|
|
|
|
|
] }, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
has 'kokolores_attributes' => ( |
45
|
|
|
|
|
|
|
is => 'ro', isa => 'ArrayRef[Str]', default => sub { [ |
46
|
|
|
|
|
|
|
'socket_path', 'socket_mode', 'satisfy', |
47
|
|
|
|
|
|
|
] }, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has 'Plugin' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new_from_file { |
53
|
1
|
|
|
1
|
0
|
19
|
my ( $class, $file ) = @_; |
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
|
|
|
21
|
if( ! -f $file ) { |
56
|
0
|
|
|
|
|
0
|
print(STDERR 'configuration file '.$file.' does not exist!\n'); |
57
|
0
|
|
|
|
|
0
|
exit 1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
11
|
tie my %config_hash, "Tie::IxHash"; |
61
|
1
|
|
|
|
|
18
|
%config_hash = ParseConfig( |
62
|
|
|
|
|
|
|
-AllowMultiOptions => 'no', |
63
|
|
|
|
|
|
|
-ConfigFile => $file, |
64
|
|
|
|
|
|
|
-Tie => "Tie::IxHash" |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
2173
|
return $class->new( %config_hash ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub apply_config { |
71
|
0
|
|
|
0
|
0
|
|
my ( $self, $main ) = @_; |
72
|
0
|
|
|
|
|
|
my $server = $main->{'server'}; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
foreach my $attr ( @{$self->overwrittable_attributes}) { |
|
0
|
|
|
|
|
|
|
75
|
0
|
0
|
|
|
|
|
if( ! defined $server->{$attr} ) { |
76
|
0
|
|
|
|
|
|
$server->{$attr} = $self->$attr; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
0
|
|
|
|
|
|
foreach my $attr ( @{$self->net_server_attributes}) { |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$server->{$attr} = $self->$attr; |
81
|
|
|
|
|
|
|
} |
82
|
0
|
|
|
|
|
|
foreach my $attr ( @{$self->kokolores_attributes}) { |
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$main->{$attr} = $self->$attr; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
$main->{'kokolores_config'} = $self; |
86
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=pod |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=encoding UTF-8 |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Auth::Kokolores::Config - configuration for Auth::Kokolores |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
version 1.00 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This software is Copyright (c) 2016 by Markus Benning <ich@markusbenning.de>. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This is free software, licensed under: |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |