If there are multiple Defaults settings of the same type, the last
matching setting is used. The following Defaults settings are parsed
before all others since they may affect subsequent entries: _\bf_\bq_\bd_\bn,
- _\br_\bu_\bn_\ba_\bs_\b__\bd_\be_\bf_\ba_\bu_\bl_\bt, _\bs_\bu_\bd_\bo_\be_\br_\bs_\b__\bl_\bo_\bc_\ba_\bl_\be.
+ _\bg_\br_\bo_\bu_\bp_\b__\bp_\bl_\bu_\bg_\bi_\bn, _\br_\bu_\bn_\ba_\bs_\b__\bd_\be_\bf_\ba_\bu_\bl_\bt, _\bs_\bu_\bd_\bo_\be_\br_\bs_\b__\bl_\bo_\bc_\ba_\bl_\be.
See _\bS_\bU_\bD_\bO_\bE_\bR_\bS _\bO_\bP_\bT_\bI_\bO_\bN_\bS for a list of supported Defaults parameters.
The following Defaults settings are parsed before all others since
they may affect subsequent entries:
\fIfqdn\fR,
+\fIgroup_plugin\fR,
\fIrunas_default\fR,
\fIsudoers_locale\fR.
.PP
The following Defaults settings are parsed before all others since
they may affect subsequent entries:
.Em fqdn ,
+.Em group_plugin ,
.Em runas_default ,
.Em sudoers_locale .
.Pp
#else
{ "fqdn" },
#endif
+ { "group_plugin" },
{ "runas_default" },
{ "sudoers_locale" },
{ NULL }
}
#endif /* HAVE_DLOPEN || HAVE_SHL_LOAD */
+
+/*
+ * Group plugin sudoers callback.
+ */
+bool
+cb_group_plugin(const union sudo_defs_val *sd_un)
+{
+ bool rc = true;
+ debug_decl(cb_group_plugin, SUDOERS_DEBUG_PLUGIN)
+
+ /* Unload any existing group plugin before loading a new one. */
+ group_plugin_unload();
+ if (sd_un->str != NULL)
+ rc = group_plugin_load(sd_un->str);
+ debug_return_bool(rc);
+}
/* XXX - collect post-sudoers parse settings into a function */
- /*
- * Initialize external group plugin, if any.
- */
- if (def_group_plugin) {
- if (group_plugin_load(def_group_plugin) != true)
- def_group_plugin = NULL;
- }
-
/*
* Set runas passwd/group entries based on command line or sudoers.
* Note that if runas_group was specified without runas_user we
/* Set fqdn callback. */
sudo_defs_table[I_FQDN].callback = cb_fqdn;
+ /* Set group_plugin callback. */
+ sudo_defs_table[I_GROUP_PLUGIN].callback = cb_group_plugin;
+
/* Set runas callback. */
sudo_defs_table[I_RUNAS_DEFAULT].callback = cb_runas_default;
void group_plugin_unload(void);
int group_plugin_query(const char *user, const char *group,
const struct passwd *pwd);
+bool cb_group_plugin(const union sudo_defs_val *sd_un);
extern const char *path_plugin_dir;
/* editor.c */
if (!init_defaults())
sudo_fatalx(U_("unable to initialize sudoers default values"));
+ /* Set group_plugin callback. */
+ sudo_defs_table[I_GROUP_PLUGIN].callback = cb_group_plugin;
+
/* Set runas callback. */
sudo_defs_table[I_RUNAS_DEFAULT].callback = cb_runas_default;
(void) fputs(" (problem with defaults entries)", stdout);
puts(".");
- if (def_group_plugin && group_plugin_load(def_group_plugin) != true)
- def_group_plugin = NULL;
-
/*
* Set runas passwd/group entries based on command line or sudoers.
* Note that if runas_group was specified without runas_user we