Deleted Added
full compact
rmuser.sh (107694) rmuser.sh (109750)
1#!/bin/sh
2#
3# Copyright (c) 2002 Michael Telahun Makonnen. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Email: Mike Makonnen <mtm@identd.net>
28#
1#!/bin/sh
2#
3# Copyright (c) 2002 Michael Telahun Makonnen. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Email: Mike Makonnen <mtm@identd.net>
28#
29# $FreeBSD: head/usr.sbin/adduser/rmuser.sh 107694 2002-12-09 02:22:50Z tjr $
29# $FreeBSD: head/usr.sbin/adduser/rmuser.sh 109750 2003-01-23 19:58:16Z fjoe $
30#
31
32ATJOBDIR="/var/at/jobs"
33CRONJOBDIR="/var/cron/tabs"
34MAILSPOOL="/var/mail"
35SIGKILL="-KILL"
36TEMPDIRS="/tmp /var/tmp"
37THISCMD=`/usr/bin/basename $0`

--- 116 unchanged lines hidden (view full) ---

154
155# prompt_yesno msg
156# Prompts the user with a $msg. The answer is expected to be
157# yes, no, or some variation thereof. This subroutine returns 0
158# if the answer was yes, 1 if it was not.
159#
160prompt_yesno() {
161 # The argument is required
30#
31
32ATJOBDIR="/var/at/jobs"
33CRONJOBDIR="/var/cron/tabs"
34MAILSPOOL="/var/mail"
35SIGKILL="-KILL"
36TEMPDIRS="/tmp /var/tmp"
37THISCMD=`/usr/bin/basename $0`

--- 116 unchanged lines hidden (view full) ---

154
155# prompt_yesno msg
156# Prompts the user with a $msg. The answer is expected to be
157# yes, no, or some variation thereof. This subroutine returns 0
158# if the answer was yes, 1 if it was not.
159#
160prompt_yesno() {
161 # The argument is required
162 [ -n "$1" ] && msg=$1 || return
162 [ -n "$1" ] && msg="$1" || return
163
164 while : ; do
163
164 while : ; do
165 echo -n $msg
165 echo -n "$msg"
166 read _ans
167 case $_ans in
168 [Nn][Oo]|[Nn])
169 return 1
170 ;;
171 [Yy][Ee][Ss]|[Yy][Ee]|[Yy])
172 return 0
173 ;;

--- 121 unchanged lines hidden (view full) ---

295 echo "Matching password entry:"
296 echo
297 echo $userrec
298 echo
299 if ! prompt_yesno "Is this the entry you wish to remove? " ; then
300 continue
301 fi
302 _homedir=`echo $userrec | awk -F: '{print $9}'`
166 read _ans
167 case $_ans in
168 [Nn][Oo]|[Nn])
169 return 1
170 ;;
171 [Yy][Ee][Ss]|[Yy][Ee]|[Yy])
172 return 0
173 ;;

--- 121 unchanged lines hidden (view full) ---

295 echo "Matching password entry:"
296 echo
297 echo $userrec
298 echo
299 if ! prompt_yesno "Is this the entry you wish to remove? " ; then
300 continue
301 fi
302 _homedir=`echo $userrec | awk -F: '{print $9}'`
303 if prompt_yesno "Remove user's home directory ($_homedir)?: "; then
303 if prompt_yesno "Remove user's home directory ($_homedir)? "; then
304 pw_rswitch="-r"
305 fi
306 else
307 pw_rswitch="-r"
308 fi
309
310 # Disable any further attempts to log into this account
311 pw 2>/dev/null lock $_user
312
313 # Remove crontab, mail spool, etc. Then obliterate the user from
314 # the passwd and group database.
315 rm_crontab $_user
316 rm_at_jobs $_user
317 kill_procs $_user
318 rm_mail $_user
319 rm_files $_user
320 rm_user $_user
321done
304 pw_rswitch="-r"
305 fi
306 else
307 pw_rswitch="-r"
308 fi
309
310 # Disable any further attempts to log into this account
311 pw 2>/dev/null lock $_user
312
313 # Remove crontab, mail spool, etc. Then obliterate the user from
314 # the passwd and group database.
315 rm_crontab $_user
316 rm_at_jobs $_user
317 kill_procs $_user
318 rm_mail $_user
319 rm_files $_user
320 rm_user $_user
321done