Browse Source

Merge pull request #5490 from TDT-AG/pr/20180123-stunnel-fix-reload

net/stunnel: fix reload and crash loop on invalid configuration
lilik-openwrt-22.03
Hannu Nyman 7 years ago
committed by GitHub
parent
commit
8372e4ce89
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions
  1. +2
    -3
      net/stunnel/Makefile
  2. +14
    -13
      net/stunnel/files/stunnel.init

+ 2
- 3
net/stunnel/Makefile View File

@ -9,11 +9,10 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=stunnel PKG_NAME:=stunnel
PKG_VERSION:=5.44 PKG_VERSION:=5.44
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0+ PKG_LICENSE:=GPL-2.0+
PKG_MAINTAINER:=Daniel Engberg <daniel.engberg.lists@pyret.net> \
Florian Eckert <fe@dev.tdt.de>
PKG_MAINTAINER:=Florian Eckert <fe@dev.tdt.de>
PKG_LICENSE_FILES:=COPYING COPYRIGHT.GPL PKG_LICENSE_FILES:=COPYING COPYRIGHT.GPL
PKG_SOURCE_URL:= \ PKG_SOURCE_URL:= \


+ 14
- 13
net/stunnel/files/stunnel.init View File

@ -7,6 +7,7 @@ USE_PROCD=1
PID_FILE="/var/run/stunnel.pid" PID_FILE="/var/run/stunnel.pid"
CONF_FILE="/tmp/stunnel.conf" CONF_FILE="/tmp/stunnel.conf"
BIN="/usr/bin/stunnel" BIN="/usr/bin/stunnel"
SERVICE_SECTION_FOUND=0
global_defs() { global_defs() {
local debug compression local debug compression
@ -86,6 +87,7 @@ service_section() {
config_get_bool enabled "$cfg" 'enabled' '1' config_get_bool enabled "$cfg" 'enabled' '1'
[ ${enabled} -gt 0 ] || return 0 [ ${enabled} -gt 0 ] || return 0
SERVICE_SECTION_FOUND=1
printf "\n" >> "$CONF_FILE" printf "\n" >> "$CONF_FILE"
printf "[%s]\n" "$cfg" >> "$CONF_FILE" printf "[%s]\n" "$cfg" >> "$CONF_FILE"
@ -150,30 +152,29 @@ process_config() {
rm -f "$CONF_FILE" rm -f "$CONF_FILE"
# Symlink "alt_config_file" since it's a bit easier and safer # Symlink "alt_config_file" since it's a bit easier and safer
ln -s "$alt_config_file" "$CONF_FILE" ln -s "$alt_config_file" "$CONF_FILE"
# Set section found to start service user hopfully knows what you does
SERVICE_SECTION_FOUND=1
return 0 return 0
} }
config_foreach service_section service config_foreach service_section service
} }
reload_service() {
process_config
# SIGHUP is used by stunnel to do init.d reload
procd_send_signal stunnel
}
service_triggers() { service_triggers() {
procd_add_reload_trigger "stunnel" procd_add_reload_trigger "stunnel"
} }
start_service() { start_service() {
procd_open_instance
procd_set_param command "$BIN"
procd_append_param command "$CONF_FILE"
process_config process_config
# set auto respawn behavior
procd_set_param respawn
procd_close_instance
if [ "$SERVICE_SECTION_FOUND" = 1 ]; then
procd_open_instance
procd_set_param command "$BIN"
procd_append_param command "$CONF_FILE"
procd_set_param respawn
procd_set_param file "$CONF_FILE"
procd_close_instance
else
logger -t stunnel -p daemon.info "No uci service section enabled or found!"
fi
} }

Loading…
Cancel
Save