From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 27 14:10:16 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 993F716A4CE for ; Fri, 27 Feb 2004 14:10:16 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91C9B43D2F for ; Fri, 27 Feb 2004 14:10:16 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i1RMAGbv063091 for ; Fri, 27 Feb 2004 14:10:16 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i1RMAF16063089; Fri, 27 Feb 2004 14:10:15 -0800 (PST) (envelope-from gnats) Date: Fri, 27 Feb 2004 14:10:15 -0800 (PST) Message-Id: <200402272210.i1RMAF16063089@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "Christian S.J. Peron" Subject: Re: bin/55980: [patch] rmuser does not remove IPC mechanisms owned by the user X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Christian S.J. Peron" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2004 22:10:16 -0000 The following reply was made to PR bin/55980; it has been noted by GNATS. From: "Christian S.J. Peron" To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/55980: [patch] rmuser does not remove IPC mechanisms owned by the user Date: Fri, 27 Feb 2004 18:01:20 +0000 My previous patch implements redundant flags when calling xargs. I have re-created the patch to be a bit more sane. --- usr.sbin/adduser/rmuser.sh.bak Fri Feb 27 15:54:13 2004 +++ usr.sbin/adduser/rmuser.sh Fri Feb 27 17:41:32 2004 @@ -145,6 +145,19 @@ verbose && echo '.' } +# rm_ipc login +# Remove all IPC mechanisms which are owned by the user. +# +rm_ipc() { + verbose && echo "Removing IPC mechanisms" + for i in s m q + do + ipcs -$i | grep ^$i | awk -v usr=$1 \ + '{ if ($5 == usr) { print $2 } }' | \ + xargs -n 1 ipcrm -$i + done +} + # 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 +351,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