Date: Sun, 25 Oct 2015 18:12:04 +0000 (UTC) From: Jeffrey Cutter Message-ID: <1442933701.496290.1445796724771.JavaMail.yahoo@...2084...> In-Reply-To: <311679276.3534103.1443637554683.JavaMail.yahoo@...2084...> References: <311679276.3534103.1443637554683.JavaMail.yahoo@...2084...> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_496289_204684419.1445796724759" Subject: [Openvpn-devel] [PATCH] Update contrib/pull-resolv-conf/client.up for no DOMAIN Reply-To: Jeffrey Cutter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "openvpn-devel@lists.sourceforge.net" ------=_Part_496289_204684419.1445796724759 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Author: Jeffrey Cutter Update contrib/pull-resolv-conf/client.up for no DOMAIN When no DOMAIN is received from push/pull, do not add either domain or sear= ch to the resolv.conf. Fix typo in comment resolv.con[f]. Only add new line when using domain or search. Signed-off-by: Jeffrey Cutter ---=C2=A0contrib/pull-resolv-conf/client.up | 13 ++++++++-----=C2=A01 file = changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/pull-resolv-conf/client.up b/contrib/pull-resolv-conf/= client.upindex b28d4d1..8858b47 100644--- a/contrib/pull-resolv-conf/client= .up+++ b/contrib/pull-resolv-conf/client.up@@ -50,9 +50,10 @@ nl=3D'=C2=A0#= or=C2=A0# "dhcp-option DNS 10.10.10.10" (multiple allowed) -# each DNS option becomes a "nameserver" option in resolv.con+# each DNS o= ption becomes a "nameserver" option in resolv.conf=C2=A0# if we get one DOM= AIN, that becomes "domain" in resolv.conf=C2=A0# if we get multiple DOMAINS= , those become "search" lines in resolv.conf+# if we get no DOMAINS, then d= on't use either domain or search. =C2=A0while true; do=C2=A0 =C2=A0eval fopt=3D\$foreign_option_${i}@@ -78,13= +79,15 @@ while true; do=C2=A0 =C2=A0i=3D$((i + 1))=C2=A0done -ds=3Ddomain-if [ $ndoms -gt 1 ]; then- =C2=A0ds=3Dsearch+ds=3D""+if [ $ndo= ms -eq 1 ]; then+ =C2=A0ds=3D"${nl}domain"+elif [ $ndoms -gt 1 ]; then+ =C2= =A0ds=3D"${nl}search"=C2=A0fi =C2=A0# This is the complete file - "$domains" has a leading space already-= out=3D"# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${nl}${ds}${dom= ains}"+out=3D"# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${ds}${d= omains}" =C2=A0# use resolvconf if it's available=C2=A0if type resolvconf >/dev/null= 2>&1; then--2.4.3 =20=20= ------=_Part_496289_204684419.1445796724759 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Author: Jeffrey Cutter <jeff_m_cutter@...109...= >

<= div id=3D"yiv6248551822yui_3_16_0_1_1443622177058_34127" dir=3D"ltr">Update contrib/pull-resolv= -conf/client.up for no DOMAIN

When no DOMAIN is received f= rom 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 sea= rch.

Signed-off-by: Jeffrey Cutter <jeff_m_cutter@...109...>

---
 contrib/pull-resolv-co= nf/client.up | 13 ++++++++-----
 1 file changed, 8 = insertions(+), 5 deletions(-)

=
= diff --git a/contrib/pull-resolv-conf/client.up b/contrib/pull-resolv-conf/= client.up
index b28d4d1..8858b47 100644
--- a/contrib/pull-resolv-conf/client.up
+++ b/contri= b/pull-resolv-conf/client.up
@@ -50,9 +50,10 @@ nl=3D'
 # or
 # "dhcp-option DNS 1= 0.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 reso= lv.conf
 # if we get multiple DOMAINS, those becom= e "search" lines in resolv.conf
+# if we get no DOMAINS,= then don't use either domain or search.

 while true; do
   eval fopt= =3D\$foreign_option_${i}
@@ -78,13 +79,15 @@ while tru= e; do
   i=3D$((i + 1))
&nb= sp;done

-ds=3Ddomain
-if [ $ndoms -gt 1 ]; then
-  ds=3Dsear= ch
+ds=3D""
+if [ $ndoms -eq 1 ]; the= n
+  ds=3D"${nl}domain"
+elif [= $ndoms -gt 1 ]; then
+  ds=3D"${nl}search"<= /font>
 fi

 #= This is the complete file - "$domains" has a leading space already<= /font>
-out=3D"# resolv.conf autogenerated by ${0} (${1})${nl}${dns}= ${nl}${ds}${domains}"
+out=3D"# resolv.conf autogenerate= d by ${0} (${1})${nl}${dns}${ds}${domains}"

 # use resolvconf if it's available
<= div id=3D"yiv6248551822yui_3_16_0_1_1443622177058_34127" dir=3D"ltr" class= =3D"yiv6248551822">=  if type resolvconf >/dev/null 2>&1; then
--
2.4.3

= ------=_Part_496289_204684419.1445796724759--