Sudo parsed "deref" and "tls_reqcert" in ldap.conf but didn't set the options.
The switch() in the sudo_ldap_set_options_table() function needed to be updated to treat CONF_DEREF_VAL and CONF_REQCERT_VAL data types as int. Fix from Dennis Filder. Bug #1013.
This commit is contained in:
@@ -398,6 +398,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
||||
if (strcasecmp(keyword, cur->conf_str) == 0) {
|
||||
switch (cur->type) {
|
||||
case CONF_DEREF_VAL:
|
||||
#ifdef LDAP_OPT_DEREF
|
||||
if (strcasecmp(value, "searching") == 0)
|
||||
*(int *)(cur->valp) = LDAP_DEREF_SEARCHING;
|
||||
else if (strcasecmp(value, "finding") == 0)
|
||||
@@ -406,6 +407,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
||||
*(int *)(cur->valp) = LDAP_DEREF_ALWAYS;
|
||||
else
|
||||
*(int *)(cur->valp) = LDAP_DEREF_NEVER;
|
||||
#endif /* LDAP_OPT_DEREF */
|
||||
break;
|
||||
case CONF_REQCERT_VAL:
|
||||
#ifdef LDAP_OPT_X_TLS_REQUIRE_CERT
|
||||
@@ -461,6 +463,14 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sudo_warnx(
|
||||
"internal error: unhandled CONF_ value %d for option %s",
|
||||
cur->type, cur->conf_str);
|
||||
sudo_warnx(
|
||||
"update %s to add missing support for CONF_ value %d",
|
||||
__func__, cur->type);
|
||||
break;
|
||||
}
|
||||
debug_return_bool(true);
|
||||
}
|
||||
@@ -817,6 +827,8 @@ sudo_ldap_set_options_table(LDAP *ld, struct ldap_config_table *table)
|
||||
continue;
|
||||
|
||||
switch (cur->type) {
|
||||
case CONF_DEREF_VAL:
|
||||
case CONF_REQCERT_VAL:
|
||||
case CONF_BOOL:
|
||||
case CONF_INT:
|
||||
ival = *(int *)(cur->valp);
|
||||
@@ -842,6 +854,14 @@ sudo_ldap_set_options_table(LDAP *ld, struct ldap_config_table *table)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CONF_LIST_STR:
|
||||
/* Lists are iterated over and don't set LDAP options directly. */
|
||||
break;
|
||||
default:
|
||||
sudo_warnx("internal error: unhandled CONF_ value %d for option %s",
|
||||
cur->type, cur->conf_str);
|
||||
sudo_warnx("update %s to add missing support for CONF_ value %d",
|
||||
__func__, cur->type);
|
||||
}
|
||||
}
|
||||
debug_return_int(errors ? -1 : LDAP_SUCCESS);
|
||||
|
Reference in New Issue
Block a user