diff options
author | rm <rm@FreeBSD.org> | 2019-03-06 05:13:32 +0800 |
---|---|---|
committer | rm <rm@FreeBSD.org> | 2019-03-06 05:13:32 +0800 |
commit | 10a852783683cebde2c983d135d65bf6992b6086 (patch) | |
tree | 15454ce5617e88af3746003f1207283fa216d5bd /net-p2p | |
parent | 997b403e40a408a29d37e48de521683ee16a23a4 (diff) | |
download | freebsd-ports-gnome-10a852783683cebde2c983d135d65bf6992b6086.tar.gz freebsd-ports-gnome-10a852783683cebde2c983d135d65bf6992b6086.tar.zst freebsd-ports-gnome-10a852783683cebde2c983d135d65bf6992b6086.zip |
net-p2p/deluge-cli: correct deluge_web rc-script
From the PR:
The rc.d script for deluge_web outright disrespects a user's home directory and
instead tries to execute against hardcoded /home/${deluge_web_user} paths. This
is invalid and dangerous behavior. When running as a user, the user's home
directory must be respected. The attached patch fixes this behavior as a break-fix.
PR: 234902
Submitted by: Phillip R. Jaenke <prj@rootwyrm.com>
Diffstat (limited to 'net-p2p')
-rw-r--r-- | net-p2p/deluge-cli/Makefile | 2 | ||||
-rw-r--r-- | net-p2p/deluge-cli/files/deluge_web.in | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/net-p2p/deluge-cli/Makefile b/net-p2p/deluge-cli/Makefile index 52da67fd6f85..d1b21f2654d8 100644 --- a/net-p2p/deluge-cli/Makefile +++ b/net-p2p/deluge-cli/Makefile @@ -3,7 +3,7 @@ PORTNAME= deluge DISTVERSIONPREFIX= ${PORTNAME}- DISTVERSION= 1.3.15 -PORTREVISION= 7 +PORTREVISION= 8 CATEGORIES= net-p2p python PKGNAMESUFFIX= -cli diff --git a/net-p2p/deluge-cli/files/deluge_web.in b/net-p2p/deluge-cli/files/deluge_web.in index 63962d773ac3..0b05665bee84 100644 --- a/net-p2p/deluge-cli/files/deluge_web.in +++ b/net-p2p/deluge-cli/files/deluge_web.in @@ -39,11 +39,16 @@ command_interpreter=%%PYTHON_CMD%% start_precmd=${name}_prestart stop_postcmd=${name}_poststop + deluge_web_prestart() { if [ "$deluge_web_user" = 'asjklasdfjklasdf' ]; then err 1 "You must set deluge_web_user to a real, unprivileged user" fi + deluge_web_home=$(pw user show ${deluge_web_user} | cut -d : -f 9) + if [ -z ${deluge_web_home} ]; then + err 1 "deluge_web_user does not have a valid home directory." + fi if [ ! -d "/var/run/${name}" ]; then if [ -e "/var/run/${name}" ]; then @@ -52,14 +57,13 @@ deluge_web_prestart() mkdir -p /var/run/${name} fi - if [ ! -d "/home/${deluge_web_user}/.python-eggs" ]; then - mkdir -p /home/${deluge_web_user}/.python-eggs - fi + if [ ! -d "${deluge_web_home}/.python-eggs" ]; then + mkdir ${deluge_web_home}/.python-eggs + chown -R $deluge_web_user ${deluge_web_home}/.python-eggs chmod 0755 /var/run/${name} chown -R $deluge_web_user /var/run/${name} - chown -R $deluge_web_user /home/${deluge_web_user}/.python-eggs - export PYTHON_EGG_CACHE="/home/${deluge_web_user}/.python-eggs" + export PYTHON_EGG_CACHE="${deluge_web_home}/.python-eggs" } deluge_web_poststop() @@ -72,7 +76,7 @@ load_rc_config $name : ${deluge_web_enable:="NO"} : ${deluge_web_user:="asjklasdfjklasdf"} -: ${deluge_web_confdir:="/home/${deluge_web_user}/.config/deluge"} +: ${deluge_web_confdir:="${deluge_web_home}/.config/deluge"} : ${deluge_web_loglevel:="error"} : ${deluge_web_logfile:="/var/tmp/${name}.log"} |