[Pkg-shadow-commits] r2933 - in upstream/trunk: . src

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Sun May 17 16:27:29 UTC 2009


Author: nekral-guest
Date: 2009-05-17 16:27:29 +0000 (Sun, 17 May 2009)
New Revision: 2933

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/userdel.c
Log:
	* 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.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2009-05-17 16:02:35 UTC (rev 2932)
+++ upstream/trunk/ChangeLog	2009-05-17 16:27:29 UTC (rev 2933)
@@ -1,3 +1,10 @@
+2009-05-17  Nicolas François  <nicolas.francois at 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 at centraliens.net>
 
 	* NEWS, libmisc/console.c (console): Remove the leading /dev/ from

Modified: upstream/trunk/src/userdel.c
===================================================================
--- upstream/trunk/src/userdel.c	2009-05-17 16:02:35 UTC (rev 2932)
+++ upstream/trunk/src/userdel.c	2009-05-17 16:27:29 UTC (rev 2933)
@@ -602,14 +602,19 @@
 	while ((utent = getutent ()) != NULL)
 #endif				/* !USE_UTMPX */
 	{
-		if (utent->ut_type != USER_PROCESS)
+		if (utent->ut_type != USER_PROCESS) {
 			continue;
-
+		}
 		if (strncmp (utent->ut_user, name, sizeof utent->ut_user) != 0) {
 			continue;
 		}
+		if (kill (utent->ut_pid, 0) != 0) {
+			continue;
+		}
+
 		fprintf (stderr,
-			 _("%s: user %s is currently logged in\n"), Prog, name);
+		         _("%s: user %s is currently logged in\n"),
+		         Prog, name);
 		if (!fflg) {
 #ifdef WITH_AUDIT
 			audit_logger (AUDIT_DEL_USER, Prog,




More information about the Pkg-shadow-commits mailing list