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