Package: shadow / 1:4.2-3+deb8u4

1020_fix_user_busy_errors Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Description: Fix user_busy to not leave subuid open in case of error.
Author: William Grant <wgrant@ubuntu.com>
Bug: https://bugs.launchpad.net/ubuntu/vivid/+source/shadow/+bug/1436937

Index: shadow-4.2/libmisc/user_busy.c
===================================================================
--- shadow-4.2.orig/libmisc/user_busy.c
+++ shadow-4.2/libmisc/user_busy.c
@@ -175,6 +175,9 @@ static int user_busy_processes (const ch
 	if (stat ("/", &sbroot) != 0) {
 		perror ("stat (\"/\")");
 		(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+		sub_uid_close();
+#endif				/* ENABLE_SUBIDS */
 		return 0;
 	}
 
@@ -212,6 +215,9 @@ static int user_busy_processes (const ch
 
 		if (check_status (name, tmp_d_name, uid) != 0) {
 			(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+			sub_uid_close();
+#endif				/* ENABLE_SUBIDS */
 			fprintf (stderr,
 			         _("%s: user %s is currently used by process %d\n"),
 			         Prog, name, pid);
@@ -232,6 +238,9 @@ static int user_busy_processes (const ch
 				}
 				if (check_status (name, task_path+6, uid) != 0) {
 					(void) closedir (proc);
+#ifdef ENABLE_SUBIDS
+					sub_uid_close();
+#endif				/* ENABLE_SUBIDS */
 					fprintf (stderr,
 					         _("%s: user %s is currently used by process %d\n"),
 					         Prog, name, pid);