[LEDE-DEV] [PATCH] busybox: prevent globbing, splitting
Jan-Tarek Butt
tarek at ring0.de
Fri Oct 14 10:54:53 PDT 2016
Double quote to prevent globbing and word splitting.
Signed-off-by: Jan-Tarek Butt <tarek at ring0.de>
---
package/utils/busybox/files/sysntpd | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/package/utils/busybox/files/sysntpd b/package/utils/busybox/files/sysntpd
index 98260be..10c42fc 100755
--- a/package/utils/busybox/files/sysntpd
+++ b/package/utils/busybox/files/sysntpd
@@ -16,7 +16,7 @@ get_dhcp_ntp_servers() {
[ "$filter" = "*" ] && filter="@.interface='$interface'" || filter="$filter, at .interface='$interface'"
done
- ntpservers=$(ubus call network.interface dump | jsonfilter -e "@.interface[$filter]['data']['ntpserver']")
+ ntpservers="$(ubus call network.interface dump | jsonfilter -e "@.interface[$filter]['data']['ntpserver']")"
for ntpserver in $ntpservers; do
local duplicate=0
@@ -24,7 +24,7 @@ get_dhcp_ntp_servers() {
for entry in $server; do
[ "$ntpserver" = "$entry" ] && duplicate=1
done
- [ "$duplicate" = 0 ] && server="$server $ntpserver"
+ [ "$duplicate" -eq "0" ] && server="$server $ntpserver"
done
}
@@ -41,18 +41,18 @@ start_service() {
return 1
}
- [ $enabled = 0 ] && return
+ [ "$enabled" -eq "0" ] && return
- [ $use_dhcp = 1 ] && get_dhcp_ntp_servers "$dhcp_interface"
+ [ "$use_dhcp" -eq "1" ] && get_dhcp_ntp_servers "$dhcp_interface"
[ -z "$server" ] && return
procd_open_instance
procd_set_param command "$PROG" -n -N
- [ "$enable_server" = "1" ] && procd_append_param command -l
+ [ "$enable_server" -eq "1" ] && procd_append_param command -l
[ -x "$HOTPLUG_SCRIPT" ] && procd_append_param command -S "$HOTPLUG_SCRIPT"
for peer in $server; do
- procd_append_param command -p $peer
+ procd_append_param command -p "$peer"
done
procd_set_param respawn
procd_close_instance
@@ -61,24 +61,24 @@ start_service() {
service_triggers() {
local script name use_dhcp
- script=$(readlink -f "$initscript")
- name=$(basename ${script:-$initscript})
+ script="$(readlink -f "$initscript")"
+ name="$(basename "${script:-$initscript}")"
- procd_add_config_trigger "config.change" "system" /etc/init.d/$name reload
+ procd_add_config_trigger "config.change" "system" "/etc/init.d/$name" reload
config_load system
config_get use_dhcp ntp use_dhcp 1
- [ $use_dhcp = 1 ] && {
+ [ "$use_dhcp" -eq "1" ] && {
local dhcp_interface
config_get dhcp_interface ntp dhcp_interface
if [ -n "$dhcp_interface" ]; then
for n in $dhcp_interface; do
- procd_add_interface_trigger "interface.*" $n /etc/init.d/$name reload
+ procd_add_interface_trigger "interface.*" "$n" "/etc/init.d/$name" reload
done
else
- procd_add_raw_trigger "interface.*" 1000 /etc/init.d/$name reload
+ procd_add_raw_trigger "interface.*" 1000 "/etc/init.d/$name" reload
fi
}
--
2.10.0
More information about the Lede-dev
mailing list