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

02d491
diff -up sudo-1.8.23/plugins/sudoers/cvtsudoers.c.legacy-group-processing sudo-1.8.23/plugins/sudoers/cvtsudoers.c
02d491
--- sudo-1.8.23/plugins/sudoers/cvtsudoers.c.legacy-group-processing	2018-06-28 11:24:25.966475241 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/cvtsudoers.c	2018-06-28 11:26:40.215025493 +0200
02d491
@@ -321,6 +321,15 @@ main(int argc, char *argv[])
02d491
 	sudo_fatalx("error: unhandled input %d", input_format);
02d491
     }
02d491
 
02d491
+    /*
02d491
+     * cvtsudoers group filtering doesn't work if def_match_group_by_gid
02d491
+     * is set to true by default (at compile-time). It cannot be set to false
02d491
+     * because cvtsudoers doesn't apply the parsed Defaults.
02d491
+     *
02d491
+     * Related: sudo-1.8.23-legacy-group-processing.patch
02d491
+     */
02d491
+    def_match_group_by_gid = def_legacy_group_processing = false;
02d491
+
02d491
     /* Apply filters. */
02d491
     filter_userspecs(conf);
02d491
     filter_defaults(conf);
02d491
diff -up sudo-1.8.23/plugins/sudoers/defaults.c.legacy-group-processing sudo-1.8.23/plugins/sudoers/defaults.c
02d491
--- sudo-1.8.23/plugins/sudoers/defaults.c.legacy-group-processing	2018-04-29 21:59:31.000000000 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/defaults.c	2018-06-28 11:24:25.966475241 +0200
02d491
@@ -87,6 +87,7 @@ static struct early_default early_defaul
02d491
     { I_FQDN },
02d491
 #endif
02d491
     { I_MATCH_GROUP_BY_GID },
02d491
+    { I_LEGACY_GROUP_PROCESSING },
02d491
     { I_GROUP_PLUGIN },
02d491
     { I_RUNAS_DEFAULT },
02d491
     { I_SUDOERS_LOCALE },
02d491
@@ -488,6 +489,8 @@ init_defaults(void)
02d491
     }
02d491
 
02d491
     /* First initialize the flags. */
02d491
+    def_legacy_group_processing = true;
02d491
+    def_match_group_by_gid = true;
02d491
 #ifdef LONG_OTP_PROMPT
02d491
     def_long_otp_prompt = true;
02d491
 #endif
02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.c.legacy-group-processing sudo-1.8.23/plugins/sudoers/def_data.c
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.c.legacy-group-processing	2018-04-29 21:59:31.000000000 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.c	2018-06-28 11:24:25.966475241 +0200
02d491
@@ -494,6 +494,10 @@ struct sudo_defs_types sudo_defs_table[]
02d491
 	N_("Ignore case when matching group names"),
02d491
 	NULL,
02d491
     }, {
02d491
+	"legacy_group_processing", T_FLAG,
02d491
+	N_("Don't pre-resolve all group names"),
02d491
+	NULL,
02d491
+    }, {
02d491
 	NULL, 0, NULL
02d491
     }
02d491
 };
02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.h.legacy-group-processing sudo-1.8.23/plugins/sudoers/def_data.h
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.h.legacy-group-processing	2018-04-29 21:59:31.000000000 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.h	2018-06-28 11:24:25.967475238 +0200
02d491
@@ -226,6 +226,8 @@
02d491
 #define def_case_insensitive_user (sudo_defs_table[I_CASE_INSENSITIVE_USER].sd_un.flag)
02d491
 #define I_CASE_INSENSITIVE_GROUP 113
02d491
 #define def_case_insensitive_group (sudo_defs_table[I_CASE_INSENSITIVE_GROUP].sd_un.flag)
02d491
+#define I_LEGACY_GROUP_PROCESSING 114
02d491
+#define def_legacy_group_processing (sudo_defs_table[I_LEGACY_GROUP_PROCESSING].sd_un.flag)
02d491
 
02d491
 enum def_tuple {
02d491
 	never,
02d491
diff -up sudo-1.8.23/plugins/sudoers/def_data.in.legacy-group-processing sudo-1.8.23/plugins/sudoers/def_data.in
02d491
--- sudo-1.8.23/plugins/sudoers/def_data.in.legacy-group-processing	2018-04-29 21:59:31.000000000 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/def_data.in	2018-06-28 11:24:25.967475238 +0200
02d491
@@ -357,3 +357,6 @@ case_insensitive_user
02d491
 case_insensitive_group
02d491
 	T_FLAG
02d491
 	"Ignore case when matching group names"
02d491
+legacy_group_processing
02d491
+	T_FLAG
02d491
+	"Don't pre-resolve all group names"
02d491
diff -up sudo-1.8.23/plugins/sudoers/sudoers.c.legacy-group-processing sudo-1.8.23/plugins/sudoers/sudoers.c
02d491
--- sudo-1.8.23/plugins/sudoers/sudoers.c.legacy-group-processing	2018-04-29 21:59:31.000000000 +0200
02d491
+++ sudo-1.8.23/plugins/sudoers/sudoers.c	2018-06-28 11:24:25.967475238 +0200
02d491
@@ -209,6 +209,10 @@ sudoers_policy_init(void *info, char * c
02d491
     if (set_loginclass(runas_pw ? runas_pw : sudo_user.pw))
02d491
 	ret = true;
02d491
 
02d491
+    if (!def_match_group_by_gid || !def_legacy_group_processing) {
02d491
+        def_match_group_by_gid = false;
02d491
+	def_legacy_group_processing = false;
02d491
+    }
02d491
 cleanup:
02d491
     if (!restore_perms())
02d491
 	ret = -1;