From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Apr 8 17:40:05 2003 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DC9E37B405 for ; Tue, 8 Apr 2003 17:40:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F78A43F93 for ; Tue, 8 Apr 2003 17:40:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h390e4Up036577 for ; Tue, 8 Apr 2003 17:40:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h390e4RD036576; Tue, 8 Apr 2003 17:40:04 -0700 (PDT) Resent-Date: Tue, 8 Apr 2003 17:40:04 -0700 (PDT) Resent-Message-Id: <200304090040.h390e4RD036576@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Cyrille Lefevre Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 943A537B401 for ; Tue, 8 Apr 2003 17:34:08 -0700 (PDT) Received: from smtp.noos.fr (nan-smtp-05.noos.net [212.198.2.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5475143F85 for ; Tue, 8 Apr 2003 17:34:07 -0700 (PDT) (envelope-from root@gits.dyndns.org) Received: (qmail 6836819 invoked by uid 0); 9 Apr 2003 00:34:05 -0000 Received: from unknown (HELO mail.gits.dyndns.org) ([212.198.231.234]) (envelope-sender ) by 212.198.2.74 (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 9 Apr 2003 00:34:05 -0000 Received: from mail.gits.dyndns.org (50icdetpz0zn85e2@localhost [127.0.0.1]) by mail.gits.dyndns.org (8.12.8/8.12.8) with ESMTP id h390XvLU001547 for ; Wed, 9 Apr 2003 02:33:57 +0200 (CEST) (envelope-from root@gits.dyndns.org) Received: (from root@localhost) by mail.gits.dyndns.org (8.12.8/8.12.8/Submit) id h390XupS001546; Wed, 9 Apr 2003 02:33:56 +0200 (CEST) (envelope-from root) Message-Id: <200304090033.h390XupS001546@mail.gits.dyndns.org> Date: Wed, 9 Apr 2003 02:33:56 +0200 (CEST) From: Cyrille Lefevre To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/50739: Maintainer update: astro/setiathome (nobody->setiathome) X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Cyrille Lefevre List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Apr 2003 00:40:05 -0000 >Number: 50739 >Category: ports >Synopsis: Maintainer update: astro/setiathome (nobody->setiathome) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Tue Apr 08 17:40:03 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.8-RC i386 >Organization: ACME >Environment: System: FreeBSD gits 4.8-RC FreeBSD 4.8-RC #0: Fri Mar 21 05:43:00 CET 2003 root@gits:/disk1/freebsd/stable/obj/disk2/freebsd/stable/src/sys/CUSTOM i386 >Description: change the running user from nobody to setiathome. also, add a while loop to automatically restart unexpected died setiathome. Makefile PORTREVISION bumped pkg-install nobody->setiathome files/rc.setiathome.conf variables added files/setiathome.sh nobody->setiathome startup while loop added setiathome user setup added >How-To-Repeat: n/a >Fix: Index: Makefile =================================================================== RCS file: /home/ncvs/ports/astro/setiathome/Makefile,v retrieving revision 1.36 diff -u -I$Id.*$ -I$.+BSD.*$ -r1.36 Makefile --- Makefile 8 Apr 2003 11:52:53 -0000 1.36 +++ Makefile 8 Apr 2003 23:19:14 -0000 @@ -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 @@ 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 Index: pkg-install =================================================================== RCS file: /home/ncvs/ports/astro/setiathome/pkg-install,v retrieving revision 1.9 diff -u -I$Id.*$ -I$.+BSD.*$ -r1.9 pkg-install --- pkg-install 28 Jul 2002 22:13:45 -0000 1.9 +++ pkg-install 13 Feb 2003 01:45:51 -0000 @@ -14,7 +14,7 @@ # 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 @@ -126,6 +126,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 ;; Index: files/rc.setiathome.conf =================================================================== RCS file: /home/ncvs/ports/astro/setiathome/files/rc.setiathome.conf,v retrieving revision 1.4 diff -u -I$Id.*$ -I$.+BSD.*$ -r1.4 rc.setiathome.conf --- files/rc.setiathome.conf 28 Jul 2002 22:13:45 -0000 1.4 +++ files/rc.setiathome.conf 8 Apr 2003 22:00:02 -0000 @@ -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 Index: files/setiathome.sh =================================================================== RCS file: /home/ncvs/ports/astro/setiathome/files/setiathome.sh,v retrieving revision 1.9 diff -u -I$Id.*$ -I$.+BSD.*$ -r1.9 setiathome.sh --- files/setiathome.sh 28 Jul 2002 22:13:45 -0000 1.9 +++ files/setiathome.sh 8 Apr 2003 23:05:38 -0000 @@ -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_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 @@ 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 @@ "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" \ >Release-Note: >Audit-Trail: >Unformatted: