Commit 77850ee1 authored by Paride Legovini's avatar Paride Legovini
Browse files

d/postfix.postinst: tolerate search domain with a leading dot

Search domain with a leading dot cause postfix.postinst to fail because
it constructs a 'myhostname' with a duplicate dot (see #991950).

The glibc resolver tolerates such domains and strips the leading dot
from the search domain [1]. This change makes postfix.postinst do the
same.

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/res_query.c;h=ebbe5a6a4ed86abe3fccd4a134bfcf6f613c9bbb;hb=HEAD#l411

Closes: #991950
parent 827bc9a4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ myfqdn() {
	if [ $myhostname = ${myhostname%.*} ]; then
	    if [ -f /etc/resolv.conf ]; then
		# The resolver uses the last one found, and ignores the rest
		mydom=$(sed -n 's/^search[[:space:]]*\([^[:space:]]*\).*/\1/p;s/^domain[[:space:]]*\([^[:space:]]*\).*/\1/p' /etc/resolv.conf | tail -1)
		mydom=$(sed -n 's/^search[[:space:]]*\.*\([^[:space:]]*\).*/\1/p;s/^domain[[:space:]]*\.*\([^[:space:]]*\).*/\1/p' /etc/resolv.conf | tail -1)
		myhostname="$myhostname${mydom:+.$mydom}"
	    else
		myhostname="$myhostname.UNKNOWN"