]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Update contrib/pull-resolv-conf/client.up for no DOMAIN
authorJeffrey Cutter <jeff_m_cutter@yahoo.com>
Fri, 20 May 2016 09:25:10 +0000 (12:25 +0300)
committerDavid Sommerseth <dazo@privateinternetaccess.com>
Mon, 30 May 2016 22:17:26 +0000 (00:17 +0200)
When no DOMAIN is received from push/pull, do not add either domain or
search to the resolv.conf. Fix typo in comment resolv.con[f]. Only add
new line when using domain or search.

URL: https://github.com/OpenVPN/openvpn/pull/34
Acked-by: Steffan Karger <steffan@karger.me>
Signed-off-by: Samuli Seppänen <samuli@openvpn.net>
Acked-by: Steffan Karger <steffan@karger.me>
Message-Id: <1463736310-17846-1-git-send-email-samuli@openvpn.net>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11682
Signed-off-by: David Sommerseth <dazo@privateinternetaccess.com>
contrib/pull-resolv-conf/client.up

index b28d4d191713013cb41afe4e1d7223ee47d4a755..8858b4766d9e4af5f88ffb36b3c5ac3c213d8d03 100644 (file)
@@ -50,9 +50,10 @@ nl='
 # or
 # "dhcp-option DNS 10.10.10.10" (multiple allowed)
 
-# each DNS option becomes a "nameserver" option in resolv.con
+# each DNS option becomes a "nameserver" option in resolv.conf
 # if we get one DOMAIN, that becomes "domain" in resolv.conf
 # if we get multiple DOMAINS, those become "search" lines in resolv.conf
+# if we get no DOMAINS, then don't use either domain or search.
 
 while true; do
   eval fopt=\$foreign_option_${i}
@@ -78,13 +79,15 @@ while true; do
   i=$((i + 1))
 done
 
-ds=domain
-if [ $ndoms -gt 1 ]; then
-  ds=search
+ds=""
+if [ $ndoms -eq 1 ]; then
+  ds="${nl}domain"
+elif [ $ndoms -gt 1 ]; then
+  ds="${nl}search"
 fi
 
 # This is the complete file - "$domains" has a leading space already
-out="# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${nl}${ds}${domains}"
+out="# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${ds}${domains}"
 
 # use resolvconf if it's available
 if type resolvconf >/dev/null 2>&1; then