| 1 | package Configd::Language::postfix; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Configd::Language::postfix::VERSION = '0.005'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | #ABSTRACT: main.cf and master.cf, which postfix has never had a conf.d for. | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.034; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use re '/aa'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use parent qw{Configd::Language}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | # The parameters where two fragments each naming something both meant it. This | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # is the list postfix's own documentation describes as taking "a comma and/or | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # space separated list of domain names" and friends -- setting one of these from | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # two places is the case this whole distribution exists for. | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # Deliberately not here: the *_restrictions parameters. They are lists too, but | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # ordered ones where the meaning depends on which check comes first and a | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # permit_ in the wrong place opens a relay. Joining two of them end to end | ||||||||||||||||||||||||||||||||||||||||||
| 23 | # produces something that parses and is not what either fragment meant, so they | ||||||||||||||||||||||||||||||||||||||||||
| 24 | # stay a value a later fragment replaces, and disagreeing about one is something | ||||||||||||||||||||||||||||||||||||||||||
| 25 | # somebody should have to notice. | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | my %ACCUMULATES = map { $_ => 1 } qw{ | |||||||||||||||||||||||||||||||||||||||||
| 27 | mydestination | ||||||||||||||||||||||||||||||||||||||||||
| 28 | myhostname_aliases | ||||||||||||||||||||||||||||||||||||||||||
| 29 | masquerade_domains | ||||||||||||||||||||||||||||||||||||||||||
| 30 | mynetworks | ||||||||||||||||||||||||||||||||||||||||||
| 31 | relay_domains | ||||||||||||||||||||||||||||||||||||||||||
| 32 | virtual_alias_domains | ||||||||||||||||||||||||||||||||||||||||||
| 33 | virtual_mailbox_domains | ||||||||||||||||||||||||||||||||||||||||||
| 34 | local_recipient_maps | ||||||||||||||||||||||||||||||||||||||||||
| 35 | virtual_alias_maps | ||||||||||||||||||||||||||||||||||||||||||
| 36 | virtual_mailbox_maps | ||||||||||||||||||||||||||||||||||||||||||
| 37 | transport_maps | ||||||||||||||||||||||||||||||||||||||||||
| 38 | sender_bcc_maps | ||||||||||||||||||||||||||||||||||||||||||
| 39 | recipient_bcc_maps | ||||||||||||||||||||||||||||||||||||||||||
| 40 | header_checks | ||||||||||||||||||||||||||||||||||||||||||
| 41 | body_checks | ||||||||||||||||||||||||||||||||||||||||||
| 42 | mime_header_checks | ||||||||||||||||||||||||||||||||||||||||||
| 43 | nested_header_checks | ||||||||||||||||||||||||||||||||||||||||||
| 44 | alias_maps | ||||||||||||||||||||||||||||||||||||||||||
| 45 | alias_database | ||||||||||||||||||||||||||||||||||||||||||
| 46 | sender_dependent_relayhost_maps | ||||||||||||||||||||||||||||||||||||||||||
| 47 | smtpd_sender_login_maps | ||||||||||||||||||||||||||||||||||||||||||
| 48 | smtp_sasl_password_maps | ||||||||||||||||||||||||||||||||||||||||||
| 49 | smtp_tls_policy_maps | ||||||||||||||||||||||||||||||||||||||||||
| 50 | smtpd_milters | ||||||||||||||||||||||||||||||||||||||||||
| 51 | non_smtpd_milters | ||||||||||||||||||||||||||||||||||||||||||
| 52 | inet_interfaces | ||||||||||||||||||||||||||||||||||||||||||
| 53 | proxy_read_maps | ||||||||||||||||||||||||||||||||||||||||||
| 54 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
files: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | { path => '/etc/postfix/main.cf', owner => 'root:root', mode => 0o644 }, | |||||||||||||||||||||||||||||||||||||||||
| 60 | { path => '/etc/postfix/master.cf', owner => 'root:root', mode => 0o644 }, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub units { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
units: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | # The templated unit rather than postfix.service: on Debian and Ubuntu | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # postfix.service is a oneshot whose ExecStart is /bin/true, and the daemon | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # that actually reads these files is an instance of postfix@.service -- | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # postfix@-.service being the default one. Naming the template covers every | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # instance, including ones somebody adds later. | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return ('postfix@.service'); | |||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub services { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
services: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | # Not the template: systemctl refuses to restart one, because a template is | ||||||||||||||||||||||||||||||||||||||||||
| 77 | # not a thing that runs. postfix.service is the wrapper the package enables | ||||||||||||||||||||||||||||||||||||||||||
| 78 | # and every instance is PartOf it, so restarting it takes the instances with | ||||||||||||||||||||||||||||||||||||||||||
| 79 | # it -- which is what the packaging intends you to do. | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return ('postfix.service'); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | sub accumulates { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accumulates: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my ( $self, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | return $ACCUMULATES{$key} // 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ACCUMULATES{$key} // 0
MC/DC0%0/1
$ACCUMULATES{$key} // 0
$ACCUMULATES{$key}
Truth table0%0/2
A
A= $ACCUMULATES{$key}
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub combine { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
combine: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my ( $self, $key, @items ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return 'all' if $key eq 'inet_interfaces' && grep { $_ eq 'all' } @items; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key eq "inet_interfaces" and grep {$_ eq "all";} @items
MC/DC0%0/2
$key eq "inet_interfaces" and grep {$_ eq "all";} @items
$key eq "inet_interfaces"
grep {$_ eq "all";} @items
Truth table0%0/3
A and B
A= $key eq "inet_interfaces"B= grep {$_ eq "all";} @items
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | return @items; | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my ( $self, $text ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return $self->_is_master($text) ? $self->_parse_master($text) : $self->_parse_main($text); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | # A master.cf row is a service name followed by its type, and nothing in main.cf | ||||||||||||||||||||||||||||||||||||||||||
| 103 | # looks like that -- every setting there is `name = value`. | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub _is_master { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_master: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my ( $self, $text ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | foreach my $line ( split( qq{\n}, $text ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | next if $line =~ m/\A\s*(?:#|\z)/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | return 0 if $line =~ m/\A\S+\s*=/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | return 1 if $line =~ m/\A\S+\s+(?:inet|unix|unix-dgram|fifo|pass)\s/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub _parse_main { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_main: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my ( $self, $text ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my @directives; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | foreach my $line ( split( qq{\n}, $text ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | # Postfix continues a value onto any following line that begins with | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # whitespace. It belongs to the parameter above it, so it cannot be | ||||||||||||||||||||||||||||||||||||||||||
| 124 | # merged on its own and has to travel with it. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | if ( $line =~ m/\A\s+\S/ && @directives && defined $directives[-1]{key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$line =~ /\A\s+\S/aa and @directives and defined $directives[-1]{"key"}
$line =~ /\A\s+\S/aa and @directives
MC/DC0%0/3
$line =~ /\A\s+\S/aa and @directives and defined $directives[-1]{"key"}
$line =~ /\A\s+\S/aa
@directives
defined $directives[-1]{"key"}
Truth table0%0/4
A and B and C
A= $line =~ /\A\s+\S/aaB= @directivesC= defined $directives[-1]{"key"}
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $continued = $line =~ s/\A\s+|\s+\z//gr; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | # `param =` with the value on the lines below it is how postfix's | ||||||||||||||||||||||||||||||||||||||||||
| 129 | # own main.cf writes the long ones, so the first continuation of an | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # empty value must not arrive with a space in front of it. | ||||||||||||||||||||||||||||||||||||||||||
| 131 | $directives[-1]{value} = | ||||||||||||||||||||||||||||||||||||||||||
| 132 | length $directives[-1]{value} | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | ? "$directives[-1]{value} $continued" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | : $continued; | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ( $line =~ m/\A\s*(?:#.*)?\z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | push @directives, { text => $line }; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if ( $line =~ m/\A(\S+?)\s*=\s*(.*?)\s*\z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | push @directives, { key => $1, value => $2 }; | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | # Not a comment, not a setting, and postfix would refuse to start on it. | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | die "Cannot parse postfix main.cf line: $line\n"; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | return \@directives; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub _parse_master { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_master: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my ( $self, $text ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my @directives; | |||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | foreach my $line ( split( qq{\n}, $text ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | # Same continuation rule, and here it is how a service's command line | ||||||||||||||||||||||||||||||||||||||||||
| 162 | # gets its -o overrides, one per line. | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if ( $line =~ m/\A\s+\S/ && @directives && defined $directives[-1]{key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$line =~ /\A\s+\S/aa and @directives and defined $directives[-1]{"key"}
$line =~ /\A\s+\S/aa and @directives
MC/DC0%0/3
$line =~ /\A\s+\S/aa and @directives and defined $directives[-1]{"key"}
$line =~ /\A\s+\S/aa
@directives
defined $directives[-1]{"key"}
Truth table0%0/4
A and B and C
A= $line =~ /\A\s+\S/aaB= @directivesC= defined $directives[-1]{"key"}
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | push @{ $directives[-1]{continuation} }, ( $line =~ s/\s+\z//r ); | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ( $line =~ m/\A\s*(?:#.*)?\z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | push @directives, { text => $line }; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | my @columns = split( /\s+/, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | die "Cannot parse postfix master.cf line (wanted 8 columns, got " . scalar(@columns) . "): $line\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | if @columns < 8; | ||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | # A service is identified by its name and its type together: smtp has | ||||||||||||||||||||||||||||||||||||||||||
| 178 | # both an inet entry and a unix one, and they are different services. | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my ( $service, $type ) = @columns[ 0, 1 ]; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | push @directives, { | |||||||||||||||||||||||||||||||||||||||||
| 181 | key => "$service/$type", | ||||||||||||||||||||||||||||||||||||||||||
| 182 | columns => [ @columns[ 0 .. 6 ] ], | ||||||||||||||||||||||||||||||||||||||||||
| 183 | value => join( q{ }, @columns[ 7 .. $#columns ] ), | ||||||||||||||||||||||||||||||||||||||||||
| 184 | continuation => [], | ||||||||||||||||||||||||||||||||||||||||||
| 185 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | return \@directives; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub emit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
emit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my ( $self, $directives ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $is_master = scalar( grep { _is_master_key( $_->{key} ) } @$directives ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | return $is_master ? $self->_emit_master($directives) : $self->_emit_main($directives); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | # A master.cf directive is keyed on the service and its type together, which is | ||||||||||||||||||||||||||||||||||||||||||
| 200 | # the one key in either file with a slash in it: main.cf parameter names are | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # word characters and underscores. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | sub _is_master_key { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_master_key: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my ($key) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | return defined $key && index( $key, q{/} ) >= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $key && index($key, '/') != -1
MC/DC0%0/2
defined $key && index($key, '/') != -1
defined $key
index($key, '/') != -1
Truth table0%0/3
A && B
A= defined $keyB= index($key, '/') != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub _emit_main { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_emit_main: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ( $self, $directives ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $out = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | foreach my $directive (@$directives) { | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ( !defined $directive->{key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | $out .= ( $directive->{text} // q{} ) . "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$directive->{"text"} // ""
MC/DC0%0/1
$directive->{"text"} // ""
$directive->{"text"}
Truth table0%0/2
A
A= $directive->{"text"}
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $out .= "$directive->{key} = $directive->{value}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub _emit_master { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_emit_master: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ( $self, $directives ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $out = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | foreach my $directive (@$directives) { | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | if ( !defined $directive->{key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $out .= ( $directive->{text} // q{} ) . "\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$directive->{"text"} // ""
MC/DC0%0/1
$directive->{"text"} // ""
$directive->{"text"}
Truth table0%0/2
A
A= $directive->{"text"}
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | # master.cf is read by column position, so the columns are padded to the | ||||||||||||||||||||||||||||||||||||||||||
| 233 | # widths postfix's own file uses rather than joined with single spaces. | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my @columns = @{ $directive->{columns} }; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $out .= sprintf( "%-14s %-6s %-7s %-7s %-7s %-7s %-7s %s\n", @columns, $directive->{value} ); | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | $out .= "$_\n" for @{ $directive->{continuation} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$directive->{"continuation"} // []
MC/DC0%0/1
$directive->{"continuation"} // []
$directive->{"continuation"}
Truth table0%0/2
A
A= $directive->{"continuation"}
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | __END__ | ||||||||||||||||||||||||||||||||||||||||||