int fr_ldap_map_verify(map_t *map, void *instance);
-int fr_ldap_map_expand(TALLOC_CTX *ctx, fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps);
+int fr_ldap_map_expand(TALLOC_CTX *ctx, fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps, char const *generic_attr);
int fr_ldap_map_do(request_t *request,
char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry);
/** Expand values in an attribute map where needed
*
- * @param[in] ctx to allocate any dynamic expansions in.
- * @param[out] expanded array of attributes. Need not be initialised (we'll initialise).
- * @param[in] request The current request.
- * @param[in] maps to expand.
+ * @param[in] ctx o allocate any dynamic expansions in.
+ * @param[out] expanded array of attributes. Need not be initialised (we'll initialise).
+ * @param[in] request The current request.
+ * @param[in] maps to expand.
+ * @param[in] generic_attr name to append to the attribute list.
* @return
* - 0 on success.
* - -1 on failure.
*/
-int fr_ldap_map_expand(TALLOC_CTX *ctx, fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps)
+int fr_ldap_map_expand(TALLOC_CTX *ctx, fr_ldap_map_exp_t *expanded, request_t *request, map_list_t const *maps, char const *generic_attr)
{
map_t const *map = NULL;
unsigned int total = 0;
}
expanded->attrs[total++] = attr;
}
+
+ if (generic_attr) expanded->attrs[expanded->count++] = generic_attr;
+
+ expanded->attrs[expanded->count] = NULL;
expanded->attrs[total] = NULL;
expanded->count = total;
expanded->maps = maps;
/*
* Synchronous expansion of maps (fixme!)
*/
- if (fr_ldap_map_expand(xlat_ctx, &xlat_ctx->expanded, request, &inst->user_map) < 0) goto error;
+ if (fr_ldap_map_expand(xlat_ctx, &xlat_ctx->expanded, request, &inst->user_map, inst->valuepair_attr) < 0) goto error;
ttrunk = fr_thread_ldap_trunk_get(t, host_url, handle_config->admin_identity,
handle_config->admin_password, request, handle_config);
if (host) ldap_memfree(host);
/*
* Expand the RHS of the maps to get the name of the attributes.
*/
- if (fr_ldap_map_expand(map_ctx, &map_ctx->expanded, request, maps) < 0) goto fail;
+ if (fr_ldap_map_expand(map_ctx, &map_ctx->expanded, request, maps, NULL) < 0) goto fail;
/*
* If the URL is <scheme>:/// the parsed host will be NULL - use config default
* for many things besides searching for users.
*/
- if (fr_ldap_map_expand(autz_ctx, expanded, request, &inst->user_map) < 0) {
+ if (fr_ldap_map_expand(autz_ctx, expanded, request, &inst->user_map, inst->valuepair_attr) < 0) {
fail:
talloc_free(autz_ctx);
RETURN_MODULE_FAIL;
CHECK_EXPANDED_SPACE(expanded);
expanded->attrs[expanded->count++] = inst->profile_attr_suspend;
}
-
- if (inst->valuepair_attr) {
- CHECK_EXPANDED_SPACE(expanded);
- expanded->attrs[expanded->count++] = inst->valuepair_attr;
- }
-
expanded->attrs[expanded->count] = NULL;
autz_ctx->dlinst = mctx->inst;