bin/55980: [patch] rmuser does not remove IPC mechanisms owned by
the user
Chris S.J.Peron
maneo at bsdpro.com
Mon Aug 25 18:20:11 PDT 2003
>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 at 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:
More information about the freebsd-bugs
mailing list