While it is very much an edge case, properly anchoring the regex ensures that the local domain only ever gets stripped if it is indeed a suffix of the fully-qualified hostname.
Prevents situations where the DHCP server sends the following client configuration: host-name: host.foo.bar domain-name: foo Which would result in `bar.foo` being set as the search domain in the final system without this patch. Fixes: a9c0a44 ("run env: fix dhcp-set hostname containing local domain") Signed-off-by: Christoph Heiss <c.he...@proxmox.com> --- Not sure how that one slipped through. Proxmox/Install/RunEnv.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm index 5d932ab..540bec7 100644 --- a/Proxmox/Install/RunEnv.pm +++ b/Proxmox/Install/RunEnv.pm @@ -296,7 +296,7 @@ sub query_installation_environment : prototype() { if (my $fqdn = Proxmox::Sys::Net::get_dhcp_hostname()) { if (defined(my $domain = $output->{network}->{dns}->{domain})) { # strip domain name suffix, if possible - $fqdn =~ s/\.${domain}//; + $fqdn =~ s/\.${domain}$//; } $output->{network}->{hostname} = $fqdn; -- 2.49.0 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel