Files
shadow/debian/patches/428_grpck_add_prune_option
T

55 lines
1.3 KiB
Plaintext

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.
Index: shadow-4.1.0/src/grpck.c
===================================================================
--- shadow-4.1.0.orig/src/grpck.c
+++ shadow-4.1.0/src/grpck.c
@@ -139,6 +139,7 @@
/* Options */
static bool read_only = false;
static bool sort_mode = false;
+static bool prune = false;
/* local function prototypes */
static void usage (void);
@@ -163,7 +164,7 @@
/*
* Parse the command line arguments
*/
- while ((arg = getopt (argc, argv, "qrs")) != EOF) {
+ while ((arg = getopt (argc, argv, "qprs")) != EOF) {
switch (arg) {
case 'q':
/* quiet - ignored for now */
@@ -174,6 +175,9 @@
case 's':
sort_mode = true;
break;
+ case 'p':
+ prune = true;
+ break;
default:
usage ();
}
@@ -296,9 +300,14 @@
/*
* 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;
}
/*
* All group file deletions wind up here. This code