[PATCH] avoid multiple "domain" entries in resolv.conf
Corey Hickey
bugfood-ml at fatooh.org
Fri Aug 5 20:21:33 PDT 2016
On 2016-03-23 04:23, David Woodhouse wrote:
> Thanks. Please could I have that with a Signed-off-by: as described at
> http://www.infradead.org/openconnect/contribute.html
Sorry, it took forever for me to swing back to this.
Here's a signed-off patch.
commit e9d1e3314106dba72f0ec3382f13be441d38e82c
Author: Corey Hickey <bugfood-ml at fatooh.org>
Date: Mon 2016-03-14 12:35:20
avoid multiple "domain" entries in resolv.conf
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 at fatooh.org>
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
Thanks,
Corey
More information about the openconnect-devel
mailing list