aboutsummaryrefslogtreecommitdiffstats
path: root/astro
diff options
context:
space:
mode:
authorcjc <cjc@FreeBSD.org>2003-04-09 13:02:42 +0800
committercjc <cjc@FreeBSD.org>2003-04-09 13:02:42 +0800
commit1795e239d19343c64ad0891e2c1fb4ac1ce4d3c0 (patch)
tree99a03046d3ff50154a44e195b260ce72916a36d8 /astro
parent1b9828fe53fbba7fd26bf8765d7f0427f5ab00c1 (diff)
downloadfreebsd-ports-gnome-1795e239d19343c64ad0891e2c1fb4ac1ce4d3c0.tar.gz
freebsd-ports-gnome-1795e239d19343c64ad0891e2c1fb4ac1ce4d3c0.tar.zst
freebsd-ports-gnome-1795e239d19343c64ad0891e2c1fb4ac1ce4d3c0.zip
Maintainer update: Don't misuse the 'nobody' account.
PR: 50739, 30701 Submitted by: Cyrille Lefevre <cyrille.lefevre@laposte.net>
Diffstat (limited to 'astro')
-rw-r--r--astro/setiathome/Makefile4
-rw-r--r--astro/setiathome/files/rc.setiathome.conf4
-rw-r--r--astro/setiathome/files/setiathome.sh69
-rw-r--r--astro/setiathome/pkg-install5
4 files changed, 67 insertions, 15 deletions
diff --git a/astro/setiathome/Makefile b/astro/setiathome/Makefile
index 7ba3ae4c896a..e5eaec458bf3 100644
--- a/astro/setiathome/Makefile
+++ b/astro/setiathome/Makefile
@@ -6,7 +6,7 @@
PORTNAME= setiathome
PORTVERSION?= 3.03
-PORTREVISION?= 5
+PORTREVISION?= 6
CATEGORIES?= astro
MASTER_SITES= ftp://ftp.cdrom.com/pub/setiathome/ \
ftp://alien.ssl.berkeley.edu/pub/
@@ -16,7 +16,9 @@ EXTRACT_SUFX= .tar
MAINTAINER?= cyrille.lefevre@laposte.net
COMMENT?= Donate idle cycles to the search for space aliens
+.if ${PORTVERSION} == "3.03"
FORBIDDEN= 'Exploitable buffer overflow. http://spoor12.edup.tudelft.nl/'
+.endif
.include <bsd.port.pre.mk>
diff --git a/astro/setiathome/files/rc.setiathome.conf b/astro/setiathome/files/rc.setiathome.conf
index 399e84349984..f7049c5855b2 100644
--- a/astro/setiathome/files/rc.setiathome.conf
+++ b/astro/setiathome/files/rc.setiathome.conf
@@ -7,6 +7,8 @@
# seti_std_args=-email # command arguments for standard mode
# seti_reg_args=-login # command arguments for register mode
# seti_proxy_args= # proxy arguments
-# seti_user=nobody # user id to run as
+# seti_user=setiathome # user id to run as
+# seti_group=${seti_user} # group id to run as
# seti_nice=15 # nice level to run at
# seti_maxprocs=$(sysctl -n hw.ncpu) # max. number of processes to start
+# seti_sleep=21600 # time to sleep between restarts
diff --git a/astro/setiathome/files/setiathome.sh b/astro/setiathome/files/setiathome.sh
index 25a98dc737e2..5ef7c315747f 100644
--- a/astro/setiathome/files/setiathome.sh
+++ b/astro/setiathome/files/setiathome.sh
@@ -5,7 +5,12 @@
# Start or stop SETI@home, or set up working directory and register.
#
+case $0 in
+/*) rc_dir=${0%/*} ;;
+ *) rc_dir=${PWD:-$(pwd)} ;;
+esac
rc_file=${0##*/}
+rc_path=${rc_dir}/${rc_file}
rc_arg=$1
# override these variables in ${PREFIX}/etc/rc.setiathome.conf
@@ -13,11 +18,13 @@ seti_wrkdir=/var/db/${rc_file%.sh} # primary working directory
seti_std_args=-email # command arguments for standard mode
seti_reg_args=-login # command arguments for register mode
seti_proxy_args= # proxy arguments
-seti_user=nobody # user id to run as
+seti_user=setiathome # user id to run as
+seti_group=${seti_user} # group id to run as
seti_nice=15 # nice level to run at
seti_maxprocs=$(sysctl -n hw.ncpu) # max. number of processes to start
+seti_sleep=21600 # time to sleep between restarts
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
+if ! PREFIX=$(expr ${rc_path} : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
echo "${rc_file}: Cannot determine PREFIX." >&2
echo "Please use the complete pathname." >&2
exit 64
@@ -68,19 +75,28 @@ start)
done
for i in ${seti_wrksuff}; do
su -fm ${seti_user} -c "\
- (cd ${seti_wrkdir}/${i} && exec ${program_path} \
- ${seti_std_args} ${seti_proxy_args} \
- ${seti_nice:+-nice} ${seti_nice} >/dev/null &)"
+ cd ${seti_wrkdir}/${i} || exit; \
+ echo \$\$ > shpid.sah; \
+ trap 'kill \$pid;exit' 15; \
+ while :; do \
+ ${program_path} \
+ ${seti_std_args} ${seti_proxy_args} \
+ ${seti_nice:+-nice} ${seti_nice} & \
+ pid=\$!; wait \$pid; \
+ sleep ${seti_sleep}; \
+ done > /dev/null" &
done
echo -n " SETI@home"
;;
stop)
for i in ${seti_wrksuff}; do
- pid_path=${seti_wrkdir}/${i}/pid.sah
- if [ -f ${pid_path} ]; then
- kill $(cat ${pid_path}) 2> /dev/null
- fi
+ for pid_path in ${seti_wrkdir}/${i}/pid.sah \
+ ${seti_wrkdir}/${i}/shpid.sah; do
+ if [ -f ${pid_path} ]; then
+ kill $(cat ${pid_path}) 2> /dev/null
+ fi
+ done
done
if [ ! -f ${seti_wrkdir}/pid.sah ]; then
killall ${program_file} 2> /dev/null
@@ -102,10 +118,39 @@ register)
"unable to register: ${program_path} is missing." >&2
exit 72
fi
+ if pw group show "${seti_group}" 2>/dev/null; then
+ echo "You already have a group \"${seti_group}\"," \
+ "so I will use it."
+ elif pw groupadd ${seti_group} -h -; then
+ echo "Added group \"${seti_group}\"."
+ else
+ echo "Adding group \"${seti_group}\" failed..."
+ echo "Please create it, and try again."
+ exit 1
+ fi
+ if pw user show "${seti_user}" 2>/dev/null; then
+ echo "You already have a user \"${seti_user}\"," \
+ "so I will use it."
+ if pw usermod ${seti_user} -d ${seti_wrkdir}; then
+ echo "Changed home directory of \"${seti_user}\"" \
+ "to \"${seti_wrkdir}\""
+ else
+ echo "Changing home directory of \"${seti_user}\"" \
+ "to \"${setu_wrkdir}\" failed..."
+ exit 1
+ fi
+ elif pw useradd ${seti_user} -g ${seti_group} -h - \
+ -d ${seti_wrkdir} -s /sbin/nologin -c "SETI at home Daemon"; then
+ echo "Added user \"${seti_user}\"."
+ else
+ echo "Adding user \"${seti_user}\" failed..."
+ echo "Please create it, and try again."
+ exit 1
+ fi
# Create or update primary working directory (in case the uid changed)
- mkdir -p ${seti_wrkdir}
- chown ${seti_user} ${seti_wrkdir}
- chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir}
+ mkdir -p ${seti_wrkdir} || exit
+ chown -Rh ${seti_user}:${seti_group} ${seti_wrkdir} || exit
+ chmod u=Xrw,g=Xr,o=Xr ${seti_wrkdir} || exit
seti_dontlogin=no
if [ -f ${seti_wrkdir}/user_info.sah ]; then
echo " It seems you have already registered with" \
diff --git a/astro/setiathome/pkg-install b/astro/setiathome/pkg-install
index 151035f60526..f77e51636a02 100644
--- a/astro/setiathome/pkg-install
+++ b/astro/setiathome/pkg-install
@@ -14,7 +14,7 @@ PKG_ACTION=$2
# override these variables in ${PREFIX}/etc/rc.setiathome.conf
seti_wrkdir=/var/db/${PKG_NAME} # working directory
-seti_user=nobody # user id to run under
+seti_user=setiathome # user id to run under
seti_maxprocs=$(sysctl -n hw.ncpu) # max. number of processes to start
rcconf_dir=${PKG_PREFIX}/etc
@@ -127,6 +127,9 @@ echo " to do so, but think about it twince before."
else
echo "**** SETI@home working directory and temporary files removed."
fi
+ if pw usershow "${seti_user}" 2>/dev/null 1>&2; then
+echo "To permanently delete SETI@home user, use 'pw userdel ${seti_user}'"
+ fi
;;
PRE-INSTALL|POST-DEINSTALL)