[pmg-devel] [PATCH pmg-api 1/2] fall back to hostname only if no domain defined

Mira Limbeck m.limbeck at proxmox.com
Tue Jun 11 15:27:28 CEST 2019


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 at proxmox.com>
---
 bin/pmg-smtp-filter | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/pmg-smtp-filter b/bin/pmg-smtp-filter
index d198239..a5bf246 100755
--- a/bin/pmg-smtp-filter
+++ b/bin/pmg-smtp-filter
@@ -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,
-- 
2.11.0



More information about the pmg-devel mailing list