]> git.proxmox.com Git - pmg-api.git/commitdiff
fall back to hostname only if no domain defined
authorMira Limbeck <m.limbeck@proxmox.com>
Tue, 11 Jun 2019 13:27:28 +0000 (15:27 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 17 Jun 2019 08:51:33 +0000 (10:51 +0200)
fall back to hostname only if no domain is defined in /etc/resolv.conf.
this removes the 'Use of uninitialized value' warning for
'$msginfo->{domain}'.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
bin/pmg-smtp-filter

index d1982390dedc8c6990d0d3969eab93c5753f83a5..a5bf246595d876a9825051067757a59d4949fc43 100755 (executable)
@@ -643,7 +643,8 @@ sub handle_smtp {
        my $resolv = PVE::INotify::read_file('resolvconf');
 
        $msginfo->{domain} = $resolv->{search};
-       $msginfo->{fqdn} = "$msginfo->{hostname}.$msginfo->{domain}";
+       $msginfo->{fqdn} = $msginfo->{hostname};
+       $msginfo->{fqdn} .= ".$msginfo->{domain}" if $msginfo->{domain};
        $msginfo->{lcid} = $lcid;
 
        # $msginfo->{targets} is case sensitive,