From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH installer] run env: anchor domain suffix strip regex to end of string
Date: Wed, 16 Jul 2025 12:13:15 +0200 [thread overview]
Message-ID: <20250716101320.571502-1-c.heiss@proxmox.com> (raw)
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.heiss@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
next reply other threads:[~2025-07-16 10:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 10:13 Christoph Heiss [this message]
2025-07-16 23:30 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250716101320.571502-1-c.heiss@proxmox.com \
--to=c.heiss@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox