From c2adf36e200a25053a983d38d367ebe0551e61a6 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 13 Feb 2014 19:40:36 +0100 Subject: [PATCH] gluon-config-mode: don't let UCI_CONFIG_DIR leak to the telnet environment etc. --- .../files/etc/init.d/gluon-config-mode | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode index 5492c0ea..845ab4c3 100755 --- a/package/gluon-config-mode/files/etc/init.d/gluon-config-mode +++ b/package/gluon-config-mode/files/etc/init.d/gluon-config-mode @@ -24,33 +24,34 @@ check_enable() { } setup_network() { - export UCI_CONFIG_DIR=/var/gluon/config-mode/config + ( + export UCI_CONFIG_DIR=/var/gluon/config-mode/config - mkdir -p "$UCI_CONFIG_DIR" + mkdir -p "$UCI_CONFIG_DIR" - cp /etc/config/network "$UCI_CONFIG_DIR" + cp /etc/config/network "$UCI_CONFIG_DIR" - config_load network - config_foreach delete_interface interface + config_load network + config_foreach delete_interface interface - uci_add network interface config - uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)" - uci_set network config type 'bridge' - uci_set network config proto 'static' - uci_set network config ipaddr "$CONFIG_MODE_ADDR" - uci_set network config netmask "$CONFIG_MODE_NETMASK" + uci_add network interface config + uci_set network config ifname "$(sysconfig lan_ifname || sysconfig wan_ifname)" + uci_set network config type 'bridge' + uci_set network config proto 'static' + uci_set network config ipaddr "$CONFIG_MODE_ADDR" + uci_set network config netmask "$CONFIG_MODE_NETMASK" - uci_commit network + uci_commit network + SERVICE_DAEMONIZE=1 + SERVICE_WRITE_PID=1 + service_start /sbin/netifd -c "$UCI_CONFIG_DIR" - SERVICE_DAEMONIZE=1 - SERVICE_WRITE_PID=1 - service_start /sbin/netifd -c "$UCI_CONFIG_DIR" + setup_switch() { return 0; } - setup_switch() { return 0; } - - include /lib/network - setup_switch + include /lib/network + setup_switch + ) } start() {