* src/userdel.c, man/login.defs.d/USERDEL_CMD.xml: Move the

USERDEL_CMD script example from the source code to the
	documentation.
This commit is contained in:
nekral-guest 2009-05-12 19:23:46 +00:00
parent 321e3ed02c
commit a9b8fdc3c9
4 changed files with 42 additions and 33 deletions

View File

@ -1,3 +1,9 @@
2009-05-11 Nicolas François <nicolas.francois@centraliens.net>
* src/userdel.c, man/login.defs.d/USERDEL_CMD.xml: Move the
USERDEL_CMD script example from the source code to the
documentation.
2009-05-11 Nicolas François <nicolas.francois@centraliens.net>
* man/newusers.8.xml: PAM enabled version: describe how passwords

2
NEWS
View File

@ -1,5 +1,7 @@
$Id$
shadow-4.1.4 -> shadow-4.1.4.1 UNRELEASED
shadow-4.1.3.1 -> shadow-4.1.4 2009-05-10
- packaging

View File

@ -1,7 +1,8 @@
<!--
Copyright (c) 1991 - 1993, Julianne Frances Haugh
Copyright (c) 1991 - 1993, Chip Rosenthal
Copyright (c) 2007 - 2008, Nicolas François
Copyright (c) 1996 - 2000, Marek Michałkiewicz
Copyright (c) 2007 - 2009, Nicolas François
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -36,5 +37,35 @@
remove any at/cron/print jobs etc. owned by the user to be removed
(passed as the first argument).
</para>
<para>
The return code of the script is not taken into account.
</para>
<para>
Here is an example script, which removes the user's
cron, at and print jobs:
<programlisting>
#! /bin/sh
# Check for the required argument.
if [ $# != 1 ]; then
echo "Usage: $0 username"
exit 1
fi
# Remove cron jobs.
crontab -r -u $1
# Remove at jobs.
# Note that it will remove any jobs owned by the same UID,
# even if it was shared by a different username.
find /var/spool/cron/atjobs -name "[^.]*" -type f -user $1 -exec rm {} \;
# Remove print jobs.
lprm $1
# All done.
exit 0
</programlisting>
</para>
</listitem>
</varlistentry>

View File

@ -625,40 +625,10 @@ static void user_busy (const char *name, uid_t uid)
/*
* user_cancel - cancel cron and at jobs
*
* user_cancel removes the crontab and any at jobs for a user
* user_cancel calls a script for additional cleanups like removal of
* cron, at, or print jobs.
*/
/*
* We used to have all this stuff hardcoded here, but now
* we just run an external script - it may need to do other
* things as well (like removing print jobs) and we may not
* want to recompile userdel too often. Below is a sample
* script (should work at least on Debian 1.1). --marekm
==========
#! /bin/sh
# Check for the required argument.
if [ $# != 1 ]; then
echo Usage: $0 username
exit 1
fi
# Remove cron jobs.
crontab -r -u $1
# Remove at jobs. XXX - will remove any jobs owned by the same UID, even if
# it was shared by a different username. at really should store the username
# somewhere, and atrm should support an option to remove all jobs owned by
# the specified user - for now we have to do this ugly hack...
find /var/spool/cron/atjobs -name "[^.]*" -type f -user $1 -exec rm {} \;
# Remove print jobs.
lprm $1
# All done.
exit 0
==========
*/
static void user_cancel (const char *user)
{
char *cmd;