Blame SOURCES/sudo-1.8.23-legacy-group-processing.patch

22f5af
diff -up ./plugins/sudoers/cvtsudoers.c.legacy-processing ./plugins/sudoers/cvtsudoers.c
71b626
--- ./plugins/sudoers/cvtsudoers.c.legacy-processing	2019-10-28 13:28:52.000000000 +0100
71b626
+++ ./plugins/sudoers/cvtsudoers.c	2019-10-30 13:32:43.309480623 +0100
71b626
@@ -347,6 +347,15 @@ main(int argc, char *argv[])
22f5af
 	sudo_fatalx("error: unhandled input %d", input_format);
22f5af
     }
22f5af
 
22f5af
+    /*
22f5af
+     * cvtsudoers group filtering doesn't work if def_match_group_by_gid
22f5af
+     * is set to true by default (at compile-time). It cannot be set to false
22f5af
+     * because cvtsudoers doesn't apply the parsed Defaults.
22f5af
+     *
22f5af
+     * Related: sudo-1.8.23-legacy-group-processing.patch
22f5af
+     */
22f5af
+    def_match_group_by_gid = def_legacy_group_processing = false;
22f5af
+
22f5af
     /* Apply filters. */
22f5af
     filter_userspecs(&parsed_policy, conf);
22f5af
     filter_defaults(&parsed_policy, conf);
22f5af
diff -up ./plugins/sudoers/defaults.c.legacy-processing ./plugins/sudoers/defaults.c
71b626
--- ./plugins/sudoers/defaults.c.legacy-processing	2019-10-28 13:28:52.000000000 +0100
71b626
+++ ./plugins/sudoers/defaults.c	2019-10-30 13:32:43.309480623 +0100
71b626
@@ -93,6 +93,7 @@ static struct early_default early_defaul
22f5af
     { I_FQDN },
22f5af
 #endif
22f5af
     { I_MATCH_GROUP_BY_GID },
22f5af
+    { I_LEGACY_GROUP_PROCESSING },
22f5af
     { I_GROUP_PLUGIN },
22f5af
     { I_RUNAS_DEFAULT },
22f5af
     { I_SUDOERS_LOCALE },
71b626
@@ -494,6 +495,8 @@ init_defaults(void)
22f5af
     }
22f5af
 
22f5af
     /* First initialize the flags. */
22f5af
+    def_legacy_group_processing = true;
22f5af
+    def_match_group_by_gid = true;
22f5af
 #ifdef LONG_OTP_PROMPT
22f5af
     def_long_otp_prompt = true;
22f5af
 #endif
22f5af
diff -up ./plugins/sudoers/def_data.c.legacy-processing ./plugins/sudoers/def_data.c
71b626
--- ./plugins/sudoers/def_data.c.legacy-processing	2019-10-30 13:32:43.309480623 +0100
71b626
+++ ./plugins/sudoers/def_data.c	2019-10-30 13:37:25.914602825 +0100
71b626
@@ -506,6 +506,10 @@ struct sudo_defs_types sudo_defs_table[]
71b626
 	N_("Log when a command is denied by sudoers"),
22f5af
 	NULL,
22f5af
     }, {
22f5af
+	"legacy_group_processing", T_FLAG,
22f5af
+	N_("Don't pre-resolve all group names"),
22f5af
+	NULL,
22f5af
+    }, {
22f5af
 	NULL, 0, NULL
22f5af
     }
22f5af
 };
22f5af
diff -up ./plugins/sudoers/def_data.h.legacy-processing ./plugins/sudoers/def_data.h
71b626
--- ./plugins/sudoers/def_data.h.legacy-processing	2019-10-30 13:32:43.310480638 +0100
71b626
+++ ./plugins/sudoers/def_data.h	2019-10-30 13:40:59.651713757 +0100
71b626
@@ -232,6 +232,8 @@
71b626
 #define def_log_allowed         (sudo_defs_table[I_LOG_ALLOWED].sd_un.flag)
71b626
 #define I_LOG_DENIED            116
71b626
 #define def_log_denied          (sudo_defs_table[I_LOG_DENIED].sd_un.flag)
71b626
+#define I_LEGACY_GROUP_PROCESSING 117
22f5af
+#define def_legacy_group_processing (sudo_defs_table[I_LEGACY_GROUP_PROCESSING].sd_un.flag)
22f5af
 
22f5af
 enum def_tuple {
22f5af
 	never,
22f5af
diff -up ./plugins/sudoers/def_data.in.legacy-processing ./plugins/sudoers/def_data.in
71b626
--- ./plugins/sudoers/def_data.in.legacy-processing	2019-10-30 13:32:43.310480638 +0100
71b626
+++ ./plugins/sudoers/def_data.in	2019-10-30 13:42:20.915896239 +0100
71b626
@@ -366,3 +366,6 @@ log_allowed
71b626
 log_denied
22f5af
 	T_FLAG
71b626
 	"Log when a command is denied by sudoers"
22f5af
+legacy_group_processing
22f5af
+	T_FLAG
22f5af
+	"Don't pre-resolve all group names"
22f5af
diff -up ./plugins/sudoers/sudoers.c.legacy-processing ./plugins/sudoers/sudoers.c
71b626
--- ./plugins/sudoers/sudoers.c.legacy-processing	2019-10-28 13:28:53.000000000 +0100
71b626
+++ ./plugins/sudoers/sudoers.c	2019-10-30 13:32:43.310480638 +0100
71b626
@@ -221,6 +221,10 @@ sudoers_policy_init(void *info, char * c
22f5af
     if (set_loginclass(runas_pw ? runas_pw : sudo_user.pw))
22f5af
 	ret = true;
22f5af
 
22f5af
+    if (!def_match_group_by_gid || !def_legacy_group_processing) {
22f5af
+        def_match_group_by_gid = false;
22f5af
+	def_legacy_group_processing = false;
22f5af
+    }
22f5af
 cleanup:
22f5af
     if (!restore_perms())
22f5af
 	ret = -1;