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);
|
||||
|
@@ -64,6 +64,11 @@
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configuration data types.
|
||||
* When adding a new data type, be sure to update sudo_ldap_parse_keyword()
|
||||
* and sudo_ldap_set_options_table().
|
||||
*/
|
||||
#define CONF_BOOL 0
|
||||
#define CONF_INT 1
|
||||
#define CONF_STR 2
|
||||
@@ -77,7 +82,7 @@
|
||||
|
||||
struct ldap_config_table {
|
||||
const char *conf_str; /* config file string */
|
||||
int type; /* CONF_BOOL, CONF_INT, CONF_STR */
|
||||
int type; /* CONF_* value, see above */
|
||||
int opt_val; /* LDAP_OPT_* (or -1 for sudo internal) */
|
||||
void *valp; /* pointer into ldap_conf */
|
||||
};
|
||||
|
Reference in New Issue
Block a user