Handle parsing boolean options that have no explicit value.

This commit is contained in:
Todd C. Miller
2018-03-02 10:44:33 -07:00
parent 9af4447c3d
commit e750bae75d

View File

@@ -731,12 +731,16 @@ ldif_store_options(struct ldif_str_list *options)
TAILQ_INIT(d->binding); TAILQ_INIT(d->binding);
d->type = DEFAULTS; d->type = DEFAULTS;
d->op = sudo_ldap_parse_option(ls->str, &var, &val); d->op = sudo_ldap_parse_option(ls->str, &var, &val);
d->var = strdup(var); if ((d->var = strdup(var)) == NULL) {
d->val = strdup(val);
if (d->var == NULL || d->val == NULL) {
sudo_fatalx(U_("%s: %s"), __func__, sudo_fatalx(U_("%s: %s"), __func__,
U_("unable to allocate memory")); U_("unable to allocate memory"));
} }
if (val != NULL) {
if ((d->val = strdup(val)) == NULL) {
sudo_fatalx(U_("%s: %s"), __func__,
U_("unable to allocate memory"));
}
}
TAILQ_INSERT_TAIL(&defaults, d, entries); TAILQ_INSERT_TAIL(&defaults, d, entries);
} }
debug_return; debug_return;