]> www.infradead.org Git - users/dwmw2/vpnc-scripts.git/commitdiff
avoid multiple "domain" entries in resolv.conf
authorCorey Hickey <bugfood-ml@fatooh.org>
Sat, 6 Aug 2016 03:21:33 +0000 (20:21 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 10 Aug 2016 21:17:31 +0000 (22:17 +0100)
This fixes a bug when $CISCO_DEF_DOMAIN contains multiple domains. When
resolv.conf has a line like this:

domain example.com example.org

...then the "host" command fails:

 $ host web001
host: parse of /etc/resolv.conf failed

This patch makes vpnc-script use the first entry in CISCO_DEF_DOMAIN for
the "domain" entry.

Signed-off-by: Corey Hickey <bugfood-ml@fatooh.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
vpnc-script

index 2a38bcdaf3abc40d3ff9e1fb2cebef14480bc0da..c3aafa426c26f2152c695310385f8365ccb1051f 100755 (executable)
@@ -369,6 +369,8 @@ modify_resolvconf_generic() {
 # and will be overwritten by vpnc
 # as long as the above mark is intact"
 
+       # If multiple domains are listed, prefer the first for "domain".
+       DOMAIN="${CISCO_DEF_DOMAIN%% *}"
        # Remember the original value of CISCO_DEF_DOMAIN we need it later
        CISCO_DEF_DOMAIN_ORIG="$CISCO_DEF_DOMAIN"
        # Don't step on INTERNAL_IP4_DNS value, use a temporary variable
@@ -393,9 +395,8 @@ EOF
                                fi
                                ;;
                        domain*)
-                               if [ -n "$CISCO_DEF_DOMAIN" ]; then
-                                       LINE="domain $CISCO_DEF_DOMAIN"
-                                       CISCO_DEF_DOMAIN=""
+                               if [ -n "$DOMAIN" ]; then
+                                       LINE="domain $DOMAIN"
                                fi
                                ;;
                esac