25 RCSID(
"$Id: 202481613a47404389e4d4f9c22afbc90abe0e2c $")
27 #include <freeradius-devel/ldap/base.h>
55 PERROR(
"Failed to allocate LDAP referral container");
116 int referral_no = -1;
118 LDAPURLDesc temp_desc;
144 if (!referral)
continue;
146 referral->
query = query;
150 "Failed parsing referral LDAP URL %s", query->
referral_urls[referral_no]);
156 temp_desc = (LDAPURLDesc){
162 referral->
host_uri = ldap_url_desc2str(&temp_desc);
165 "Failed building LDAP host URI from %s", query->
referral_urls[referral_no]);
168 if (
config->use_referral_credentials) {
175 for (ext = referral->
referral_url->lud_exts; ext && *ext; ext++) {
177 bool critical =
false;
195 "Failed parsing extension \"%s\": "
196 "No attribute/value delimiter '='", *ext);
204 if (!p)
goto bad_ext;
211 "Failed parsing critical extension \"%s\": "
212 "Not supported by FreeRADIUS", *ext);
230 "No active LDAP trunk for URI %s, bound as %s",
280 referral->
ttrunk = ttrunk;
371 referral->
ttrunk = ttrunk;
static void * fr_dlist_talloc_free_item(fr_dlist_head_t *list_head, void *ptr)
Free the item specified.
static void * fr_dlist_next(fr_dlist_head_t const *list_head, void const *ptr)
Get the next item in a list.
static void fr_dlist_talloc_free(fr_dlist_head_t *head)
Free all items in a doubly linked list (with talloc)
static unsigned int fr_dlist_num_elements(fr_dlist_head_t const *head)
Return the number of elements in the dlist.
static int fr_dlist_insert_tail(fr_dlist_head_t *list_head, void *ptr)
Insert an item into the tail of a list.
#define fr_dlist_talloc_init(_head, _type, _field)
Initialise the head structure of a doubly linked list.
void unlang_interpret_mark_runnable(request_t *request)
Mark a request as resumable.
LDAPURLDesc * referral_url
URL for the referral.
fr_trunk_request_t * treq
Trunk request this query is associated with.
char * host_uri
Host URI used for referral connection.
fr_ldap_config_t * config
Module instance config.
char ** referral_urls
Referral results to follow.
uint16_t referral_depth
How many referrals we have followed.
fr_ldap_thread_trunk_t * fr_thread_ldap_trunk_get(fr_ldap_thread_t *thread, char const *uri, char const *bind_dn, char const *bind_password, request_t *request, fr_ldap_config_t const *config)
Find a thread specific LDAP connection for a specific URI / bind DN.
fr_dlist_head_t referrals
List of parsed referrals.
fr_ldap_result_code_t ret
Result code.
request_t * request
Request this referral relates to.
fr_trunk_state_t fr_thread_ldap_trunk_state(fr_ldap_thread_t *thread, char const *uri, char const *bind_dn)
Lookup the state of a thread specific LDAP connection trunk for a specific URI / bind DN.
char const * identity
Bind identity for referral connection.
fr_ldap_query_t * query
Query this referral relates to.
@ LDAP_RESULT_ERROR
A general error occurred.
char const * password
Bind password for referral connection.
fr_trunk_t * trunk
Connection trunk.
fr_ldap_thread_trunk_t * ttrunk
Trunk this referral should use.
fr_ldap_referral_t * referral
Referral actually being followed.
@ LDAP_EXT_BINDPW
Specifies the password for an LDAP bind.
@ LDAP_EXT_UNSUPPORTED
Unsupported extension.
@ LDAP_EXT_BINDNAME
Specifies the user DN or name for an LDAP bind.
Connection configuration.
Parsed LDAP referral structure.
Thread specific structure to manage LDAP trunk connections.
Thread LDAP trunk structure.
fr_table_num_sorted_t const fr_ldap_supported_extensions[]
#define ROPTIONAL(_l_request, _l_global, _fmt,...)
Use different logging functions depending on whether request is NULL or not.
static const conf_parser_t config[]
static int _fr_ldap_referral_free(fr_ldap_referral_t *referral)
Clear up a fr_ldap_referral_t.
int fr_ldap_referral_follow(fr_ldap_thread_t *t, request_t *request, fr_ldap_query_t *query)
Follow an LDAP referral.
int fr_ldap_referral_next(fr_ldap_thread_t *t, request_t *request, fr_ldap_query_t *query)
Follow an alternative LDAP referral.
fr_ldap_referral_t * fr_ldap_referral_alloc(TALLOC_CTX *ctx, request_t *request)
Allocate a new structure to handle an LDAP referral, setting the destructor.
static void _ldap_referral_send(UNUSED fr_trunk_t *trunk, UNUSED fr_trunk_state_t prev, UNUSED fr_trunk_state_t state, void *uctx)
Callback to send LDAP referral queries when a trunk becomes active.
#define fr_table_value_by_substr(_table, _name, _name_len, _def)
Convert a partial string to a value using an ordered or sorted table.
fr_trunk_watch_entry_t * fr_trunk_add_watch(fr_trunk_t *trunk, fr_trunk_state_t state, fr_trunk_watch_t watch, bool oneshot, void const *uctx)
Add a watch entry to the trunk state list.
fr_trunk_enqueue_t fr_trunk_request_enqueue(fr_trunk_request_t **treq_out, fr_trunk_t *trunk, request_t *request, void *preq, void *rctx)
Enqueue a request that needs data written to the trunk.
void fr_trunk_request_signal_complete(fr_trunk_request_t *treq)
Signal that a trunk request is complete.
Main trunk management handle.
@ FR_TRUNK_STATE_ACTIVE
Trunk has active connections.
@ FR_TRUNK_ENQUEUE_IN_BACKLOG
Request should be enqueued in backlog.
@ FR_TRUNK_ENQUEUE_OK
Operation was successful.