On 2016-04-07 20:37, [email protected] wrote:
On Thu, Apr 7, 2016, at 11:10 AM, A. Schulze wrote:
use double quotes to allow variable expansion.
single quotes force use as literal string as you see...
-> $myauthservid = "amavisd.${$mydomain}";
If I switch
my $mydomain = 'mail01.example.com';
$myhostname = 'mail01.example.com';
75 - $myauthservid = 'amavisd.${$mydomain}';
+ my $myauthservid = "amavisd.${$mydomain}";
I get an error on launch
Error in config file "/etc/amavisd/amavisd.conf": Can't use string
("mail01.example.com") as a SCALAR ref while "strict refs" in use at
/etc/amavisd/amavisd.conf line 75.
In the "amavisd.${$mydomain}" you are trying to dereference $mydomain
twice,
that is wrong.
This is probably what was intended:
$myauthservid = "amavisd.$mydomain";
or (same thing, perl syntax alternative):
$myauthservid = "amavisd.${mydomain}";
At the top of the config file I see
use strict;
Do I get rid of the 'use strict', or change something in the config
variable ?
Don't remove the 'use strict'.
And as for single- vs double- quote, what should these be then
$smtpd_greeting_banner = '${$myhostname} ${protocol} ${product} service
ready';
$smtpd_quit_banner = '${$myhostname} ${product} closing transmission
channel';
?
This is not a default setting for these two variables and is incorrect.
There is an extra $ at the beginning, it should not be there.
Here is a default setting:
$smtpd_greeting_banner = '${helo-name} ${protocol} ${product} service
ready';
$smtpd_quit_banner = '${helo-name} ${product} closing transmission
channel';
Note that this is a plain string where perl does not do any expansion.
Actually these two settings (and only these two) are special in that
they
specify a template, and amavisd later manually replaces the placeholders
with actual values. This is not an example of a perl 'interpolation'
i.e.
variable expansion within a double-quoted string.
The $smtpd_greeting_banner and $smtpd_quit_banner recognize the
following
placeholders / replacements of a form ${name} :
'helo-name' => $myheloname,
'myhostname' => idn_to_ascii(c('myhostname')),
'version' => $myversion,
'version-id' => $myversion_id,
'version-date' => $myversion_date,
'product' => $myproduct_name,
'protocol' => $lmtp?'LMTP':'ESMTP' }->{lc($1.$2)}
This complication is there to allow for lazy evaluation, as some of
these values are not yet available at the configuration time, but only
when a mail arrives.
The $myauthservid on the other hand does not have such special
semantics,
it is a plain string. The usual perl syntax rules apply when assigning
to it (double quotes interpolate variables, single quotes do not).
Mark