diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2018-02-21 19:54:26 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2018-02-21 19:54:26 +0000 |
commit | 1eccebe2fe99a9acf28306e90a773bff3b5e562b (patch) | |
tree | 933d10a4fd467df7f9c5f5c6959f8ecb10da4901 /distrib/miniroot | |
parent | 573af6b243f6f37e4cc1d80d3b1e5ecebf2ecd4d (diff) |
If there is one interface, and it is configured via dhcp, and the lease
contains both domain-name and domain-search options make sure to use the
first domain-name entry (there might be multiple).
This issue was noticed by Raf Czlonka, thanks for reporting
Discussed with, tested and OK krw
Diffstat (limited to 'distrib/miniroot')
-rw-r--r-- | distrib/miniroot/install.sub | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 740064a86a8..839ac13cbe5 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: install.sub,v 1.1063 2018/02/18 01:50:04 kn Exp $ +# $OpenBSD: install.sub,v 1.1064 2018/02/21 19:54:25 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -251,7 +251,9 @@ __EOT lease_value() { local _lf=$1 _o + [[ -s $_lf ]] || return shift + for _o; do sed -E \ -e '/^ *(option )?'"$_o"' (.*);$/!d;s//\2/' \ @@ -1999,6 +2001,12 @@ donetconfig() { # configured via dhclient too. resp="${_dn:-$(get_fqdn)}" if ifconfig dhcp >/dev/null 2>&1 && [[ $NIFS == 1 && -n $_dn ]]; then + # If we have a 'domain-name' option in the lease file use that. + # It might *NOT* not be the same as the first domain in any + # 'domain-search' option. + set -- $(get_ifs dhcp) + set -- $(lease_value /var/db/dhclient.leases.$1 domain-name) + [[ -n $1 ]] && resp=$1 echo "Using DNS domainname $resp" else ask "DNS domain name? (e.g. 'example.com')" "$resp" |