* src/userdel.c (user_busy): Check if the process registered in

utmp is still running. This avoids rejecting the removal of an
	user when UTMP was not updated and indicate that the user is still
	logged in.
This commit is contained in:
nekral-guest 2009-05-17 16:27:29 +00:00
parent 297141c6c4
commit e3343c1d9b
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2009-05-17 Nicolas François <nicolas.francois@centraliens.net>
* src/userdel.c (user_busy): Check if the process registered in
utmp is still running. This avoids rejecting the removal of an
user when UTMP was not updated and indicate that the user is still
logged in.
2009-05-16 Nicolas François <nicolas.francois@centraliens.net> 2009-05-16 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, libmisc/console.c (console): Remove the leading /dev/ from * NEWS, libmisc/console.c (console): Remove the leading /dev/ from

View File

@ -602,14 +602,19 @@ static void user_busy (const char *name, uid_t uid)
while ((utent = getutent ()) != NULL) while ((utent = getutent ()) != NULL)
#endif /* !USE_UTMPX */ #endif /* !USE_UTMPX */
{ {
if (utent->ut_type != USER_PROCESS) if (utent->ut_type != USER_PROCESS) {
continue; continue;
}
if (strncmp (utent->ut_user, name, sizeof utent->ut_user) != 0) { if (strncmp (utent->ut_user, name, sizeof utent->ut_user) != 0) {
continue; continue;
} }
if (kill (utent->ut_pid, 0) != 0) {
continue;
}
fprintf (stderr, fprintf (stderr,
_("%s: user %s is currently logged in\n"), Prog, name); _("%s: user %s is currently logged in\n"),
Prog, name);
if (!fflg) { if (!fflg) {
#ifdef WITH_AUDIT #ifdef WITH_AUDIT
audit_logger (AUDIT_DEL_USER, Prog, audit_logger (AUDIT_DEL_USER, Prog,