[pve-devel] [PATCH common 2/2] Fix #1270: properly read multiple search domains in /etc/resolv.conf

Dietmar Maurer dietmar at proxmox.com
Mon Apr 3 11:15:59 CEST 2017


This is still wrong, because a resolv.conf file may contain both, a search and
a domain line.

Also, the regex for domain is wrong (domain may only contain a single entry)!


diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm
> index 7d2001f..91aa89a 100644
> --- a/src/PVE/INotify.pm
> +++ b/src/PVE/INotify.pm
> @@ -541,7 +541,7 @@ sub read_etc_resolv_conf {
>  	chomp $line;
>  	# resolv.conf should *either* have a search or domain, else behaviour is
> undefined
>  	# see res_init.c in libc, havesearch is set to 0 when a domain entry is
> found
> -	if ($line =~ m/^(search|domain)\s+(\S+)\s*/) {
> +	if ($line =~ m/^(search|domain)\s+((\S+\s*)*)$/) {




More information about the pve-devel mailing list