};
static CONF_PARSER profile_config[] = {
+ { FR_CONF_OFFSET("scope", FR_TYPE_INT32, rlm_ldap_t, profile_scope), .dflt = "base",
+ .func = cf_table_parse_int, .uctx = &(cf_table_parse_ctx_t){ .table = fr_ldap_scope, .len = &fr_ldap_scope_len } },
{ FR_CONF_OFFSET("attribute", FR_TYPE_STRING, rlm_ldap_t, profile_attr) },
{ FR_CONF_OFFSET("attribute_suspend", FR_TYPE_STRING, rlm_ldap_t, profile_attr_suspend) },
CONF_PARSER_TERMINATOR
* User configuration
*/
static CONF_PARSER user_config[] = {
- { FR_CONF_OFFSET("scope", FR_TYPE_STRING, rlm_ldap_t, userobj_scope_str), .dflt = "sub" },
+ { FR_CONF_OFFSET("scope", FR_TYPE_INT32, rlm_ldap_t, userobj_scope), .dflt = "sub",
+ .func = cf_table_parse_int, .uctx = &(cf_table_parse_ctx_t){ .table = fr_ldap_scope, .len = &fr_ldap_scope_len } },
{ FR_CONF_OFFSET("sort_by", FR_TYPE_STRING, rlm_ldap_t, userobj_sort_by) },
{ FR_CONF_OFFSET("access_attribute", FR_TYPE_STRING, rlm_ldap_t, userobj_access_attr) },
*/
static CONF_PARSER group_config[] = {
{ FR_CONF_OFFSET("filter", FR_TYPE_STRING, rlm_ldap_t, groupobj_filter) },
- { FR_CONF_OFFSET("scope", FR_TYPE_STRING, rlm_ldap_t, groupobj_scope_str), .dflt = "sub" },
+ { FR_CONF_OFFSET("scope", FR_TYPE_INT32, rlm_ldap_t, groupobj_scope), .dflt = "sub",
+ .func = cf_table_parse_int, .uctx = &(cf_table_parse_ctx_t){ .table = fr_ldap_scope, .len = &fr_ldap_scope_len } },
{ FR_CONF_OFFSET("name_attribute", FR_TYPE_STRING, rlm_ldap_t, groupobj_name_attr), .dflt = "cn" },
{ FR_CONF_OFFSET("membership_attribute", FR_TYPE_STRING, rlm_ldap_t, userobj_membership_attr) },
}
return fr_ldap_trunk_search(&ret, profile_ctx, &profile_ctx->query, request, ttrunk, dn,
- LDAP_SCOPE_BASE, autz_ctx->call_env->profile_filter.vb_strvalue,
+ inst->profile_scope, autz_ctx->call_env->profile_filter.vb_strvalue,
expanded->attrs, NULL, NULL);
}
}
}
- /*
- * Convert scope strings to enumerated constants
- */
- inst->userobj_scope = fr_table_value_by_str(fr_ldap_scope, inst->userobj_scope_str, -1);
- if (inst->userobj_scope < 0) {
- cf_log_err(conf, "Invalid 'user.scope' value \"%s\", expected 'sub', 'one', 'base' or 'children'",
- inst->userobj_scope_str);
- goto error;
- }
-
- inst->groupobj_scope = fr_table_value_by_str(fr_ldap_scope, inst->groupobj_scope_str, -1);
- if (inst->groupobj_scope < 0) {
- cf_log_err(conf, "Invalid 'group.scope' value \"%s\", expected 'sub', 'one', 'base' or 'children'",
- inst->groupobj_scope_str);
- goto error;
- }
-
/*
* Build the server side sort control for user objects
*/
/*
* User object attributes and filters
*/
- char const *userobj_scope_str; //!< Scope (sub, one, base).
char const *userobj_sort_by; //!< List of attributes to sort by.
LDAPControl *userobj_sort_ctrl; //!< Server side sort control.
* Group object attributes and filters
*/
char const *groupobj_filter; //!< Filter to retrieve only group objects.
- char const *groupobj_scope_str; //!< Scope (sub, one, base).
int groupobj_scope; //!< Search scope.
char const *groupobj_name_attr; //!< The name of the group.
/*
* Profiles
*/
+ int profile_scope; //!< Search scope.
char const *profile_attr; //!< Attribute that identifies profiles to apply. May appear
//!< in userobj or groupobj.
char const *profile_attr_suspend; //!< Attribute that identifies profiles to apply when the user's