Date: 26 Aug 2003 01:16:19 -0000 From: "Chris S.J.Peron" <maneo@bsdpro.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/55980: [patch] rmuser does not remove IPC mechanisms owned by the user Message-ID: <20030826011619.58203.qmail@staff.seccuris.com> Resent-Message-ID: <200308260120.h7Q1K9B9083408@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 55980 >Category: bin >Synopsis: [patch] rmuser does not remove IPC mechanisms owned by the user >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 25 18:20:09 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Chris S.J. Peron >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD movl 5.1-CURRENT FreeBSD 5.1-CURRENT #14: Mon Aug 25 17:22:40 CDT 2003 modulus@movl:/usr/src/sys/i386/compile/RAID0 i386 >Description: rmuser cleans up processes and files owned by users, but does not touch any IPC mechanisms owned by the user. >How-To-Repeat: N/A >Fix: --- /usr/sbin/rmuser Tue Jun 24 22:51:27 2003 +++ /usr/sbin/rmuser2 Thu Aug 14 16:50:08 2003 @@ -145,6 +145,22 @@ verbose && echo '.' } +# rm_ipc +# Removes shared memory segments, semaphores and message queues +# owned by user $_user +# +rm_ipc() { + ipcs -s | awk -v u=$1 '/^s/ { if (u == $5) { print $2 } }' | \ + xargs -J % -n 1 ipcrm -s % + + ipcs -m | awk -v u=$1 '/^m/ { if (u == $5) { print $2 } }' | \ + xargs -J % -n 1 ipcrm -m % + + ipcs -q | awk -v u=$1 '/^q/ { if (u == $5) { print $2 } }' | \ + xargs -J % -n 1 ipcrm -q % + ! verbose && echo -n " ipc" +} + # rm_user login # Remove user $login from the system. This subroutine makes use # of the pw(8) command to remove a user from the system. The pw(8) @@ -338,6 +354,7 @@ ! verbose && echo -n "Removing user ($_user):" rm_crontab $_user rm_at_jobs $_user + rm_ipc $_user kill_procs $_user rm_files $_user rm_mail $_user >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030826011619.58203.qmail>