[PATCH] avoid multiple "domain" entries in resolv.conf
Corey Hickey
bugfood-ml at fatooh.org
Mon Mar 14 12:54:03 PDT 2016
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.
---
vpnc-script | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/vpnc-script b/vpnc-script
index 2a38bcd..4445786 100755
--- a/vpnc-script
+++ b/vpnc-script
@@ -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
--
2.7.0
More information about the openconnect-devel
mailing list