From 7ac1358249c2c3a6a4f65370b792a646dd469264 Mon Sep 17 00:00:00 2001
From: Oliver Kraitschy <okraits@arcor.de>
Date: Wed, 31 Aug 2016 16:43:07 +0200
Subject: [PATCH] Fix handling of whitespaces in common_set_list function

If the payload contains whitespaces (for example openvpn remote parameter),
the common_set_list function splits the payload at these whitespaces. This
commit fixes this issue.
---
 ext/openwrt/scripts/functions/common/common | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ext/openwrt/scripts/functions/common/common b/ext/openwrt/scripts/functions/common/common
index 0acd99a..5c54506 100755
--- a/ext/openwrt/scripts/functions/common/common
+++ b/ext/openwrt/scripts/functions/common/common
@@ -156,9 +156,11 @@ common_set_bool() {
 common_set_list() {
 	local cfg="$1"
 	local val="$2"
-	local element list=${val//,/ }
 	$UCI_DELETE $cfg
-	for element in $list; do
+	local oldIFS="$IFS"
+	IFS=','
+	for element in $val; do
+		IFS="$oldIFS"
 		$UCI_ADD_LIST $cfg="$element"
 	done
 	return 0