mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-31 14:25:15 +00:00
Instead of deferring setting early defaults until we have traversed
the entire defaults list, just defer running the callbacks. Otherwise, if the last early default setting we see has a bad value we won't set any defaults of that type even if there was an earlier one that was valid.
This commit is contained in:
@@ -1122,15 +1122,19 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
||||
|
||||
/* walk through options, early ones first */
|
||||
for (p = bv; *p != NULL; p++) {
|
||||
struct early_default *early;
|
||||
|
||||
if ((copy = strdup((*p)->bv_val)) == NULL) {
|
||||
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||
goto done;
|
||||
}
|
||||
sudo_ldap_parse_option(copy, &def);
|
||||
store_early_default(&def, SETDEF_GENERIC);
|
||||
early = is_early_default(def.var);
|
||||
if (early != NULL)
|
||||
set_early_default(def.var, def.val, def.op, false, early);
|
||||
free(copy);
|
||||
}
|
||||
apply_early_defaults(false);
|
||||
run_early_defaults();
|
||||
|
||||
/* walk through options again, skipping early ones */
|
||||
for (p = bv; *p != NULL; p++) {
|
||||
@@ -1139,7 +1143,7 @@ sudo_ldap_parse_options(LDAP *ld, LDAPMessage *entry)
|
||||
goto done;
|
||||
}
|
||||
sudo_ldap_parse_option(copy, &def);
|
||||
if (!is_early_default(def.var))
|
||||
if (is_early_default(def.var) == NULL)
|
||||
set_default(def.var, def.val, def.op, false);
|
||||
free(copy);
|
||||
}
|
||||
|
Reference in New Issue
Block a user