Merge pull request #16220 from paulfertser/socat_add_user
net: socat: add option user
This commit is contained in:
commit
ff995f404e
3 changed files with 9 additions and 2 deletions
|
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=socat
|
PKG_NAME:=socat
|
||||||
PKG_VERSION:=1.7.3.4
|
PKG_VERSION:=1.7.3.4
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||||
PKG_SOURCE_URL:=http://www.dest-unreach.org/socat/download
|
PKG_SOURCE_URL:=http://www.dest-unreach.org/socat/download
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
config socat 'http'
|
config socat 'http'
|
||||||
option enable '0'
|
option enable '0'
|
||||||
option SocatOptions '-d -d TCP6-LISTEN:8000,fork TCP4:192.168.1.20:80'
|
option SocatOptions '-d -d TCP6-LISTEN:8000,fork TCP4:192.168.1.20:80'
|
||||||
|
option user 'nobody'
|
||||||
|
|
|
@ -12,7 +12,8 @@ validate_section_socat()
|
||||||
{
|
{
|
||||||
uci_load_validate socat socat "$1" "$2" \
|
uci_load_validate socat socat "$1" "$2" \
|
||||||
'enable:bool:1' \
|
'enable:bool:1' \
|
||||||
'SocatOptions:or(string, list(string))'
|
'SocatOptions:or(string, list(string))' \
|
||||||
|
'user:string:root'
|
||||||
}
|
}
|
||||||
|
|
||||||
append_param_command()
|
append_param_command()
|
||||||
|
@ -23,6 +24,7 @@ append_param_command()
|
||||||
socat_instance()
|
socat_instance()
|
||||||
{
|
{
|
||||||
local is_list
|
local is_list
|
||||||
|
local user
|
||||||
|
|
||||||
[ "$2" = 0 ] || {
|
[ "$2" = 0 ] || {
|
||||||
echo "validation failed"
|
echo "validation failed"
|
||||||
|
@ -39,6 +41,10 @@ socat_instance()
|
||||||
else
|
else
|
||||||
config_list_foreach "$1" SocatOptions append_param_command
|
config_list_foreach "$1" SocatOptions append_param_command
|
||||||
fi
|
fi
|
||||||
|
config_get user "$1" user
|
||||||
|
if [ -n "$user" ]; then
|
||||||
|
procd_set_param user $user
|
||||||
|
fi
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
|
|
Loading…
Reference in a new issue