summaryrefslogtreecommitdiff
path: root/debian/patches/428_grpck_add_prune_option
blob: ceb00b63a644a4829a70822ac88fcc3b1e2b1519 (plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
Goal: grpck now has an (otherwise undocumented) -p option, so that
      shadowconfig can clean up the results of the above, so the config
      script will fail randomly less often.
Fixes: #103385

Status wrt upstream: It could certainly be submitted to upstream.

--- a/src/grpck.c
+++ b/src/grpck.c
@@ -79,6 +79,7 @@
 /* Options */
 static bool read_only = false;
 static bool sort_mode = false;
+static bool prune = false;
 
 /* local function prototypes */
 static void fail_exit (int status);
@@ -178,7 +179,7 @@
 	/*
 	 * Parse the command line arguments
 	 */
-	while ((c = getopt_long (argc, argv, "hqrR:s",
+	while ((c = getopt_long (argc, argv, "hqprR:s",
	                         long_options, NULL)) != -1) {
 		switch (c) {
 		case 'h':
 			usage (E_SUCCESS);
@@ -189,6 +190,9 @@
 		case 's':
 			sort_mode = true;
 			break;
+		case 'p':
+			prune = true;
+			break;
 		default:
 			usage ();
 		}
@@ -474,7 +478,12 @@
 			/*
 			 * prompt the user to delete the entry or not
 			 */
-			if (!yes_or_no (read_only)) {
+			if (!prune) {
+			        if (!yes_or_no (read_only)) {
+				        continue;
+				}
+			} else {
+				puts (_("Yes"));
 				continue;
 			}