12 #include <freeradius-devel/server/base.h>
13 #include <freeradius-devel/server/connection.h>
14 #include <freeradius-devel/server/global_lib.h>
15 #include <freeradius-devel/server/map.h>
16 #include <freeradius-devel/server/trunk.h>
17 #include <freeradius-devel/unlang/function.h>
18 #include <freeradius-devel/util/dlist.h>
20 #define LDAP_DEPRECATED 0
32 #ifndef HAVE_LDAP_CREATE_SESSION_TRACKING_CONTROL
33 # undef LDAP_CONTROL_X_SESSION_TRACKING
44 #ifdef LDAP_CONTROL_X_SESSION_TRACKING
45 # if !defined(HAVE_DECL_LDAP_CREATE_SESSION_TRACKING_CONTROL) || (HAVE_DECL_LDAP_CREATE_SESSION_TRACKING_CONTROL == 0)
47 ldap_create_session_tracking_control LDAP_P((
49 char *sessionSourceIp,
50 char *sessionSourceName,
52 struct berval *sessionTrackingIdentifier,
53 LDAPControl **ctrlp ));
65 #if !defined(LDAP_VENDOR_VERSION_PATCH) || LDAP_VENDOR_VERSION_PATCH == 0
66 # undef LDAP_VENDOR_VERSION_PATCH
67 # define LDAP_VENDOR_VERSION_PATCH 0
74 #if !defined(LDAP_SCOPE_BASE) && defined(LDAP_SCOPE_BASEOBJECT)
75 # define LDAP_SCOPE_BASE LDAP_SCOPE_BASEOBJECT
78 #if !defined(LDAP_SCOPE_ONE) && defined(LDAP_SCOPE_ONELEVEL)
79 # define LDAP_SCOPE_ONE LDAP_SCOPE_ONELEVEL
82 #if !defined(LDAP_SCOPE_SUB) && defined(LDAP_SCOPE_SUBTREE)
83 # define LDAP_SCOPE_SUB LDAP_SCOPE_SUBTREE
86 #if !defined(LDAP_OPT_RESULT_CODE) && defined(LDAP_OPT_ERROR_NUMBER)
87 # define LDAP_OPT_RESULT_CODE LDAP_OPT_ERROR_NUMBER
94 #define LDAP_MAX_CONTROLS 10
96 #define LDAP_MAX_ATTRMAP 128
98 #define LDAP_MAP_RESERVED 5
103 #define LDAP_MAX_CACHEABLE 64
108 #define LDAP_MAX_GROUP_NAME_LEN 128
109 #define LDAP_MAX_ATTR_STR_LEN 256
110 #define LDAP_MAX_FILTER_STR_LEN 1024
111 #define LDAP_MAX_DN_STR_LEN 1024
113 #define LDAP_VIRTUAL_DN_ATTR "dn"
115 #define LDAP_SERVER_NOTIFICATION_OID "1.2.840.113556.1.4.528"
117 #define LDAP_SERVER_SHOW_DELETED_OID "1.2.840.113556.1.4.417"
119 #define LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803"
120 #define LDAP_MATCHING_RULE_BIT_OR "1.2.840.113556.1.4.804"
443 struct berval *reqdata;
680 if (strlen !=
value->bv_len)
return CMP(strlen,
value->bv_len);
682 for (i = 0; i < strlen; i++) {
683 if (tolower(
value->bv_val[i]) != tolower(str[i]))
return CMP(
value->bv_val[i], str[i]);
698 int8_t uricmp =
CMP(strcmp(a->
uri, b->uri), 0);
700 if (uricmp !=0)
return uricmp;
702 return CMP(strcmp(a->
bind_dn, b->bind_dn), 0);
732 char const *base_dn,
int scope,
char const *filter,
char const *
const * attrs,
733 LDAPControl **serverctrls, LDAPControl **clientctrls);
736 LDAPMod *mods[], LDAPControl **serverctrls, LDAPControl **clientctrls);
739 LDAPControl **serverctrls, LDAPControl **clientctrls);
743 char const *base_dn,
int scope,
char const *filter,
char const *
const *attrs,
744 LDAPControl **serverctrls, LDAPControl **clientctrls);
748 char const *dn, LDAPMod *mods[],
749 LDAPControl **serverctrls, LDAPControl **clientctrls);
753 char const *reqoid,
struct berval *reqdata,
754 LDAPControl **serverctrls, LDAPControl **clientctrls);
772 char const *dn,
int scope,
char const *filter,
char const *
const *attrs,
773 LDAPControl **serverctrls, LDAPControl **clientctrls);
776 char const *dn, LDAPMod *mods[],
777 LDAPControl **serverctrls, LDAPControl **clientctrls);
781 LDAPControl **serverctrls, LDAPControl **clientctrls);
784 char const *reqiod,
struct berval *reqdata);
787 LDAPMessage *
msg,
char const *dn);
806 LDAPControl *clientctrls_out[],
807 size_t serverctrls_len,
808 size_t clientctrls_len,
810 LDAPControl *serverctrls_in[],
811 LDAPControl *clientctrls_in[]);
824 #define LDAP_DIRECTORY_ATTRS { "vendorname", \
826 "isGlobalCatalogReady", \
828 "orcldirectoryversion", \
829 "supportedControl", \
834 LDAPMessage *result,
char const *
name);
860 char const *valuepair_attr,
fr_ldap_map_exp_t const *expanded, LDAPMessage *entry);
877 char const *bind_dn,
char const *bind_password,
895 LDAPControl **serverctrls, LDAPControl **clientctrls);
903 char const *identity,
904 char const *password,
907 LDAPControl **serverctrls, LDAPControl **clientctrls);
916 char const *identity,
917 char const *password,
918 char const *proxy,
char const *realm);
925 char const *bind_dn,
char const *password,
926 LDAPControl **serverctrls, LDAPControl **clientctrls);
929 char const *bind_dn,
char const *password);
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
A section grouping multiple CONF_PAIR.
fr_dcursor_eval_t void const * uctx
static fr_time_delta_t timeout
Head of a doubly linked list.
Entry in a doubly linked list.
Structure to define how to initialise libraries with global configuration.
connection_t * fr_ldap_connection_state_alloc(TALLOC_CTX *ctx, fr_event_list_t *el, fr_ldap_config_t const *config, char const *log_prefix)
Alloc a self re-establishing connection to an LDAP server.
int fr_ldap_map_verify(map_t *map, void *instance)
size_t fr_ldap_uri_unescape_func(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg))
Converts escaped DNs and filter strings into normal.
size_t fr_ldap_util_normalise_dn(char *out, char const *in)
Normalise escape sequences in a DN.
int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request, map_t const *map, void *uctx)
Callback for map_to_request.
static void fr_ldap_berval_to_value_shallow(fr_value_box_t *value, struct berval *berval)
Inline function to copy pointers from a berval to a valuebox.
int fr_ldap_control_add_session_tracking(fr_ldap_connection_t *conn, request_t *request)
size_t fr_ldap_uri_escape_func(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg))
Converts "bad" strings into ones which are safe for LDAP.
fr_ldap_rcode_t fr_ldap_error_check(LDAPControl ***ctrls, fr_ldap_connection_t const *conn, LDAPMessage *msg, char const *dn)
Perform basic parsing of multiple types of messages, checking for error conditions.
fr_slen_t fr_ldap_filter_parse(TALLOC_CTX *ctx, fr_dlist_head_t **root, fr_sbuff_t *filter, filter_attr_check_t attr_check, void *uctx)
Parse an LDAP filter into its component nodes.
int fr_ldap_filter_to_tmpl(TALLOC_CTX *ctx, tmpl_rules_t const *t_rules, char const **sub, size_t sublen, tmpl_t **out))
Combine filters and tokenize to a tmpl.
char const * mech
SASL mech(s) to try.
struct berval ** values
libldap struct containing bv_val (char *) and length bv_len.
char const * proxy
Proxy identity, may be NULL in which case identity is used.
fr_ldap_control_t serverctrls[LDAP_MAX_CONTROLS]
Server controls specific to this query.
LDAP * ldap_global_handle
Hack for OpenLDAP libldap global initialisation.
LDAPURLDesc * referral_url
URL for the referral.
LDAPControl ** clientctrls
Controls to pass to the client (library).
LDAP * fr_ldap_handle_thread_local(void)
Get a thread local dummy LDAP handle.
uint8_t * fr_ldap_berval_to_bin(TALLOC_CTX *ctx, struct berval const *in)
Convert a berval to a talloced buffer.
int fr_ldap_conn_directory_alloc_async(fr_ldap_connection_t *ldap_conn)
Async extract useful information from the rootDSE of the LDAP server.
size_t fr_ldap_dereference_len
fr_ldap_thread_t * t
Thread this connection is associated with.
char const * tls_private_key_file
Sets the path to the private key for our public certificate.
fr_dlist_t entry
Entry in the list of connection references.
char const * proxy
Identity to proxy.
fr_time_delta_t res_timeout
How long we wait for results.
ldap_filter_logic_t
Logical operators for use in LDAP filters.
fr_ldap_rcode_t fr_ldap_search_async(int *msgid, request_t *request, fr_ldap_connection_t *pconn, char const *dn, int scope, char const *filter, char const *const *attrs, LDAPControl **serverctrls, LDAPControl **clientctrls)
Search for something in the LDAP directory.
fr_ldap_rcode_t ret
Return code of bind operation.
char * host_uri
Host URI used for referral connection.
char const * admin_password
Password used in administrative bind.
fr_ldap_state_t state
LDAP connection state machine.
fr_ldap_config_t * config
Module instance config.
void fr_ldap_control_clear(fr_ldap_connection_t *conn)
Clear and free any controls associated with a connection.
int count
Index on next free element.
fr_event_timer_t const * ev
Event for timing out the query.
bool chase_referrals
If the LDAP server returns a referral to another server or point in the tree, follow it,...
fr_table_num_sorted_t const fr_ldap_supported_extensions[]
bool fr_ldap_util_is_dn(char const *in, size_t inlen)
Check whether a string looks like a DN.
char ** referral_urls
Referral results to follow.
@ FR_LDAP_DIRECTORY_ORACLE_UNIFIED_DIRECTORY
Directory server is Oracle Unified Directory.
@ FR_LDAP_DIRECTORY_UNKNOWN
We can't determine the directory server.
@ FR_LDAP_DIRECTORY_NETSCAPE
Directory server is Netscape.
@ FR_LDAP_DIRECTORY_EDIRECTORY
Directory server is eDir.
@ FR_LDAP_DIRECTORY_ORACLE_INTERNET_DIRECTORY
Directory server is Oracle Internet Directory.
@ FR_LDAP_DIRECTORY_UNBOUND_ID
Directory server is Unbound ID.
@ FR_LDAP_DIRECTORY_SIEMENS_AG
Directory server is Siemens AG.
@ FR_LDAP_DIRECTORY_ORACLE_VIRTUAL_DIRECTORY
Directory server is Oracle Virtual Directory.
@ FR_LDAP_DIRECTORY_ACTIVE_DIRECTORY
Directory server is Active Directory.
@ FR_LDAP_DIRECTORY_OPENLDAP
Directory server is OpenLDAP.
@ FR_LDAP_DIRECTORY_SUN_ONE_DIRECTORY
Directory server is Sun One Directory.
@ FR_LDAP_DIRECTORY_IBM
Directory server is IBM.
@ FR_LDAP_DIRECTORY_SAMBA
Directory server is Samba.
int msgid
libldap msgid for this bind.
int fr_ldap_global_config(int debug_level, char const *tls_random_file)
Change settings global to libldap.
map_list_t const * maps
Head of list of maps we expanded the RHS of.
char const * fr_ldap_error_str(fr_ldap_connection_t const *conn)
Return the error string associated with a handle.
size_t fr_ldap_common_dn(char const *full, char const *part)
Find the place at which the two DN strings diverge.
char const * tls_certificate_file
Sets the path to the public certificate file we present to the servers.
char * server
Initial server to bind to.
static int8_t fr_ldap_bind_auth_cmp(void const *one, void const *two)
Compare two ldap bind auth structures on msgid.
int dereference
libldap value specifying dereferencing behaviour.
fr_ldap_sync_type_t sync_type
What kind of LDAP sync this directory supports.
uint16_t referral_depth
How many referrals we have followed.
LDAP * handle
libldap handle.
int msgid
The unique identifier for this query.
char const * dn
Base DN for searches, DN for modifications.
char const * bind_dn
DN connection is bound as.
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.
void fr_ldap_control_merge(LDAPControl *serverctrls_out[], LDAPControl *clientctrls_out[], size_t serverctrls_len, size_t clientctrls_len, fr_ldap_connection_t *conn, LDAPControl *serverctrls_in[], LDAPControl *clientctrls_in[])
Merge connection and call specific client and server controls.
fr_rb_node_t node
Entry in the tree of connections.
int serverctrls_cnt
Number of server controls associated with the handle.
fr_dlist_head_t referrals
List of parsed referrals.
int fr_ldap_attrs_check(char const **attrs, char const *attr)
Check that a particular attribute is included in an attribute list.
char const * admin_identity
Identity we bind as when we need to query the LDAP directory.
global_lib_autoinst_t fr_libldap_global_config
fr_ldap_result_code_t ret
Result code.
fr_ldap_result_parser_t parser
Custom results parser.
fr_ldap_connection_t * fr_ldap_connection_alloc(TALLOC_CTX *ctx)
Allocate our ldap connection handle layer.
bool freeit
Whether the control should be freed after we've finished using it.
fr_rb_tree_t * trunks
Tree of LDAP trunks used by this thread.
request_t * request
Request this referral relates to.
int fr_ldap_referral_follow(fr_ldap_thread_t *thread, request_t *request, fr_ldap_query_t *query)
Follow an LDAP referral.
trunk_conf_t * trunk_conf
Module trunk config.
fr_rb_tree_t * queries
Outstanding queries on this connection.
int fr_ldap_bind_async(fr_ldap_connection_t *c, char const *bind_dn, char const *password, LDAPControl **serverctrls, LDAPControl **clientctrls)
Install I/O handlers for the bind operation.
fr_ldap_rcode_t fr_ldap_result(LDAPMessage **result, LDAPControl ***ctrls, fr_ldap_connection_t const *conn, int msgid, int all, char const *dn, fr_time_delta_t timeout)
Parse response from LDAP server dealing with any errors.
fr_time_delta_t keepalive_idle
Number of seconds a connections needs to remain idle before TCP starts sending keepalive probes.
char const * dereference_str
When to dereference (never, searching, finding, always)
fr_ldap_query_t * fr_ldap_modify_alloc(TALLOC_CTX *ctx, char const *dn, LDAPMod *mods[], LDAPControl **serverctrls, LDAPControl **clientctrls)
Allocate a new LDAP modify object.
int fr_ldap_connection_timeout_set(fr_ldap_connection_t const *conn, fr_time_delta_t timeout)
fr_ldap_directory_t * directory
The type of directory we're connected to.
fr_ldap_state_t
LDAP connection handle states.
@ FR_LDAP_STATE_ERROR
Connection is in an error state.
@ FR_LDAP_STATE_BIND
Connection is being bound.
@ FR_LDAP_STATE_START_TLS
TLS is being negotiated.
@ FR_LDAP_STATE_RUN
Connection is muxing/demuxing requests.
@ FR_LDAP_STATE_INIT
Connection uninitialised.
unlang_action_t fr_ldap_trunk_modify(TALLOC_CTX *ctx, fr_ldap_query_t **out, request_t *request, fr_ldap_thread_trunk_t *ttrunk, char const *dn, LDAPMod *mods[], LDAPControl **serverctrls, LDAPControl **clientctrls)
Run an async modification LDAP query on a trunk connection.
char const * identity
of the user.
trunk_request_t * treq
Trunk request this query is associated with.
fr_event_timer_t const * ev
Event to close the thread when it has been idle.
fr_rb_node_t node
Entry in the tree of outstanding queries.
static void fr_ldap_berval_to_value_str_shallow(fr_value_box_t *value, struct berval *berval)
Inline function to copy pointer from a berval to a string value box.
fr_dlist_head_t refs
Replied to queries still referencing this connection.
char const * fr_ldap_url_err_to_str(int ldap_url_err)
Translate the error code emitted from ldap_url_parse and friends into something accessible with fr_st...
size_t fr_ldap_supported_extensions_len
size_t fr_ldap_connection_states_len
fr_table_num_sorted_t const fr_ldap_connection_states[]
int fd
File descriptor for this connection.
void fr_ldap_state_error(fr_ldap_connection_t *c)
Signal that there's been an error on the connection.
fr_dlist_t entry
Entry in list of possible referrals.
int fr_ldap_trunk_directory_alloc_async(TALLOC_CTX *ctx, fr_ldap_thread_trunk_t *ttrunk)
Async extract useful information from the rootDSE of the LDAP server.
bool fr_ldap_filter_eval(fr_dlist_head_t *root, fr_ldap_connection_t *conn, LDAPMessage *msg)
Evaluate an LDAP filter.
char const * uri
Server URI for this connection.
int fr_ldap_server_url_check(fr_ldap_config_t *handle_config, char const *server, CONF_SECTION const *cs)
Check an LDAP server entry in URL format is valid.
fr_dlist_t entry
Entry in the list of filter nodes.
const char * sasl_secprops
SASL Security Properties to set.
struct fr_ldap_referral_s fr_ldap_referral_t
Parsed LDAP referral structure.
ldap_filter_type_t
Types of parsed LDAP filter nodes.
@ LDAP_FILTER_GROUP
The filter node is a parent of a group which will be combined using a logical operator.
@ LDAP_FILTER_NODE
The filter node is an individual one to be evaluated against an attribute.
LDAPMessage * result
Previous result.
fr_time_delta_t keepalive_interval
Interval between keepalive probes.
fr_time_delta_t tls_handshake_timeout
How long we wait for the TLS handshake to complete.
int msgid
Of the bind operation. Only used when binding as admin.
char const * tls_require_cert_str
Sets requirements for validating the certificate the server presents.
fr_time_delta_t net_timeout
How long we wait in blocking network calls.
int count
Number of values.
struct fr_ldap_thread_trunk_s fr_ldap_thread_trunk_t
Thread LDAP trunk structure.
fr_ldap_config_t const * config
rlm_ldap connection configuration.
fr_ldap_connection_t * c
to bind. Only used when binding as admin user.
LDAPControl ** clientctrls
Controls to pass to the client (library).
#define LDAP_MAX_ATTRMAP
Maximum number of mappings between LDAP and.
request_t * request
this bind relates to.
fr_ldap_connection_t * c
to bind. Only used when binding as admin user.
int fr_ldap_control_add_server(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit)
Add a serverctrl to a connection handle.
fr_ldap_control_t clientctrls[LDAP_MAX_CONTROLS]
Client controls specific to this query.
fr_ldap_rcode_t fr_ldap_modify_async(int *msgid, request_t *request, fr_ldap_connection_t *pconn, char const *dn, LDAPMod *mods[], LDAPControl **serverctrls, LDAPControl **clientctrls)
Modify something in the LDAP directory.
trunk_request_t * treq
Trunk request this bind is associated with.
int fr_ldap_box_escape(fr_value_box_t *vb, UNUSED void *uctx)
char const * tls_ca_path
Sets the path to a directory containing CA certificates.
uint32_t keepalive_probes
Number of missed timeouts before the connection is dropped.
char const * realm
SASL realm (may be NULL).
bool rebind
If use_referral_credentials is false, controls whether we bind as our admin credentials (true) or ano...
static int8_t fr_ldap_query_cmp(void const *one, void const *two)
Compare two ldap query structures on msgid.
char const * mechs
SASL mechanisms to run.
fr_ldap_rcode_t fr_ldap_extended_async(int *msgid, request_t *request, fr_ldap_connection_t *pconn, char const *reqiod, struct berval *reqdata)
Initiate an LDAP extended operation.
char const * password
of the user, may be NULL if no password is specified.
static int8_t fr_ldap_trunk_cmp(void const *one, void const *two)
Compare two ldap trunk structures on connection URI / DN.
fr_ldap_config_t config
Config used for this connection.
char const * fr_ldap_edir_errstr(int code)
int tls_require_cert
OpenLDAP constant representing the require cert string.
fr_table_num_sorted_t const fr_ldap_tls_require_cert[]
char const * tls_random_file
Path to the ramdon file if /dev/random and /dev/urandom are unavailable.
int fr_ldap_server_config_check(fr_ldap_config_t *handle_config, char const *server, CONF_SECTION *cs)
Check an LDAP server config in server:port format is valid.
char * fr_ldap_berval_to_string(TALLOC_CTX *ctx, struct berval const *in)
Convert a berval to a talloced string.
fr_ldap_state_t fr_ldap_state_next(fr_ldap_connection_t *c)
Move between LDAP connection states.
fr_table_num_sorted_t const fr_ldap_dereference[]
char const * identity
Bind identity for referral connection.
bool start_tls
Send the Start TLS message to the LDAP directory to start encrypted communications using the standard...
ldap_filter_op_t
Operators for use in LDAP filters.
@ LDAP_FILTER_OP_BIT_AND
Bitwise AND comparison.
@ LDAP_FILTER_OP_PRESENT
Attribute present.
@ LDAP_FILTER_OP_SUBSTR
Attribute matches string with wildcards.
@ LDAP_FILTER_OP_EQ
Attribute equals value.
@ LDAP_FILTER_OP_LE
Attribute less than or equal to value.
@ LDAP_FILTER_OP_BIT_OR
Bitwise OR comparison.
@ LDAP_FILTER_OP_GE
Attribute greater than or equal to value.
@ LDAP_FILTER_OP_UNSET
Attribute not set yet.
bool use_referral_credentials
If true use credentials from the referral URL.
fr_ldap_query_t * query
Query this referral relates to.
char const * vendor_str
As returned from the vendorName attribute in the rootDSE.
fr_ldap_request_type_t
Types of LDAP requests.
@ LDAP_REQUEST_MODIFY
A modification to an LDAP entity.
@ LDAP_REQUEST_SEARCH
A lookup in an LDAP directory.
@ LDAP_REQUEST_DELETE
A deletion of an LDAP entity.
@ LDAP_REQUEST_EXTENDED
An extended LDAP operation.
int clientctrls_cnt
Number of client controls associated with the handle.
int fr_ldap_control_add_client(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit)
Add a clientctrl to a connection handle.
fr_ldap_connection_t * ldap_conn
LDAP connection this query is running on.
LDAPControl ** serverctrls
Controls to pass to the server.
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.
char const * realm
Kerberos realm.
char * orig
Text representation of filter for debug messages,.
fr_ldap_sasl_t admin_sasl
SASL parameters used when binding as the admin.
fr_ldap_rcode_t fr_ldap_delete_async(int *msgid, request_t *request, fr_ldap_connection_t *pconn, char const *dn, LDAPControl **serverctrls, LDAPControl **clientctrls)
Modify something in the LDAP directory.
fr_ldap_thread_trunk_t * fr_thread_ldap_bind_trunk_get(fr_ldap_thread_t *thread)
Find the thread specific trunk to use for LDAP bind auths.
fr_ldap_result_code_t
LDAP query result codes.
@ LDAP_RESULT_EXCESS_REFERRALS
The referral chain took too many hops.
@ LDAP_RESULT_REFERRAL_FAIL
Initial results indicated a referral was needed but the referral could not be followed.
@ LDAP_RESULT_TIMEOUT
The query timed out.
@ LDAP_RESULT_ERROR
A general error occurred.
@ LDAP_RESULT_SUCCESS
Successfully got LDAP results.
@ LDAP_RESULT_PENDING
Result not yet returned.
@ LDAP_RESULT_NO_RESULT
No results returned.
@ LDAP_RESULT_BAD_DN
The requested DN does not exist.
@ LDAP_RESULT_MISSING_REFERRAL
A referral was indicated but no URL was provided.
ldap_filter_type_t filter_type
Type of this filter node.
bool cleartext_password
Whether the server will return the user's plaintext password.
int msgid
Last msgid. Only used when binding as admin user.
static int fr_ldap_berval_strncasecmp(struct berval *value, char const *str, size_t strlen)
Compare a berval with a C string of a known length using case insensitive comparison.
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)
Expand values in an attribute map where needed.
char const * tls_ca_file
Sets the full path to a CA certificate (used to validate the certificate the server presents).
bool chase_referrals_unset
If true, use the OpenLDAP defaults for chase_referrals.
#define LDAP_MAP_RESERVED
Number of additional items to allocate in expanded.
char const ** server_str
Server set in the config.
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.
#define LDAP_MAX_CONTROLS
Maximum number of client/server controls.
char const * name
Name of the module that created this connection.
trunk_conf_t * bind_trunk_conf
Trunk config for bind auth trunk.
fr_time_delta_t reconnection_delay
How long to wait before attempting to reconnect.
uint16_t referral_depth
How many referrals to chase.
int fr_ldap_directory_result_parse(fr_ldap_directory_t *directory, LDAP *handle, LDAPMessage *result, char const *name)
fr_time_delta_t srv_timelimit
How long the server should spent on a single request (also bounded by value on the server).
int fr_ldap_start_tls_async(fr_ldap_connection_t *c, LDAPControl **serverctrls, LDAPControl **clientctrls)
Install I/O handlers for Start TLS negotiation.
fr_ldap_query_t * fr_ldap_search_alloc(TALLOC_CTX *ctx, char const *base_dn, int scope, char const *filter, char const *const *attrs, LDAPControl **serverctrls, LDAPControl **clientctrls)
Allocate a new search object.
void * uctx
User data associated with the handle.
int fr_ldap_parse_url_extensions(LDAPControl **sss, size_t sss_len, char *extensions[])
Parse a subset (just server side sort for now) of LDAP URL extensions.
@ FR_LDAP_SYNC_NONE
No support for LDAP sync.
@ FR_LDAP_SYNC_ACTIVE_DIRECTORY
Directory supports AD style persistent search.
@ FR_LDAP_SYNC_PERSISTENT_SEARCH
Directory supports persistent search.
@ FR_LDAP_SYNC_RFC4533
Directory supports RFC 4533.
unlang_action_t fr_ldap_trunk_extended(TALLOC_CTX *ctx, fr_ldap_query_t **out, request_t *request, fr_ldap_thread_trunk_t *ttrunk, char const *reqoid, struct berval *reqdata, LDAPControl **serverctrls, LDAPControl **clientctrls)
Run an async LDAP "extended operation" query on a trunk connection.
LDAPMessage * result
Head of LDAP results list.
fr_event_list_t * el
Thread event list for callbacks / timeouts.
fr_ldap_directory_t * directory
The type of directory we're connected to.
LDAPControl * control
LDAP control.
int fr_ldap_map_do(request_t *request, char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry)
Convert attribute map into valuepairs.
unlang_action_t fr_ldap_edir_get_password(request_t *request, char const *dn, fr_ldap_thread_trunk_t *ttrunk, fr_dict_attr_t const *password_da)
Initiate retrieval of the universal password from Novell eDirectory.
unlang_action_t fr_ldap_trunk_search(TALLOC_CTX *ctx, fr_ldap_query_t **out, request_t *request, fr_ldap_thread_trunk_t *ttrunk, char const *base_dn, int scope, char const *filter, char const *const *attrs, LDAPControl **serverctrls, LDAPControl **clientctrls)
Run an async search LDAP query on a trunk connection.
char const * rmech
Mech we're continuing with.
char const * password
Bind password for referral connection.
char const * tls_min_version_str
Minimum TLS version.
LDAPControl ** serverctrls
Controls to pass to the server.
uint16_t port
Port to use when binding to the server.
void fr_ldap_timeout_debug(request_t *request, fr_ldap_connection_t const *conn, fr_time_delta_t timeout, char const *prefix)
Prints information to the debug log on the current timeout settings.
fr_ldap_thread_trunk_t * bind_trunk
LDAP trunk used for bind auths.
int fr_ldap_connection_timeout_reset(fr_ldap_connection_t const *conn)
unlang_action_t fr_ldap_bind_auth_async(request_t *request, fr_ldap_thread_t *thread, char const *bind_dn, char const *password)
Initiate an async LDAP bind for authentication.
char const * version_str
As returned from the vendorVersion attribute in the rootDSE.
char const * bind_dn
of the user, may be NULL to bind anonymously.
void(* fr_ldap_result_parser_t)(LDAP *handle, fr_ldap_query_t *query, LDAPMessage *head, void *rctx)
trunk_t * trunk
Connection trunk.
fr_ldap_thread_t * thread
This bind is being run by.
fr_ldap_thread_trunk_t * ttrunk
Trunk this referral should use.
connection_t * conn
Connection state handle.
fr_ldap_referral_t * referral
Referral actually being followed.
size_t fr_ldap_tls_require_cert_len
fr_ldap_query_t * fr_ldap_extended_alloc(TALLOC_CTX *ctx, char const *reqiod, struct berval *reqdata, LDAPControl **serverctrls, LDAPControl **clientctrls)
Allocate a new LDAP extended operations object.
fr_table_num_sorted_t const fr_ldap_scope[]
TALLOC_CTX * ctx
Context to allocate new attributes in.
fr_rb_tree_t * binds
Tree of outstanding bind auths.
int fr_ldap_connection_configure(fr_ldap_connection_t *c, fr_ldap_config_t const *config)
Allocate and configure a new connection.
uint32_t ldap_debug
LDAP debug level.
int(* filter_attr_check_t)(char const *attr, void *uctx)
fr_rb_node_t node
Entry in the tree of outstanding bind requests.
fr_ldap_bind_type_t type
type of bind.
char const ** naming_contexts
Databases served by this directory.
int fr_ldap_referral_next(fr_ldap_thread_t *thread, request_t *request, fr_ldap_query_t *query)
Follow an alternative LDAP referral.
char const * password
of the user, may be NULL if no password is specified.
ldap_supported_extension_t
@ 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.
fr_time_delta_t idle_timeout
How long to wait before closing unused connections.
fr_ldap_directory_type_t type
Canonical server implementation.
fr_ldap_request_type_t type
What type of query this is.
int fr_ldap_init(void)
Initialise libldap and check library versions.
fr_ldap_rcode_t
Codes returned by fr_ldap internal functions.
@ LDAP_PROC_CONTINUE
Operation is in progress.
@ LDAP_PROC_SUCCESS
Operation was successful.
@ LDAP_PROC_REFERRAL
LDAP server returned referral URLs.
@ LDAP_PROC_TIMEOUT
Operation timed out.
@ LDAP_PROC_ERROR
Unrecoverable library/server error.
@ LDAP_PROC_BAD_CONN
Transitory error, caller should retry the operation with a new connection.
@ LDAP_PROC_NOT_PERMITTED
Operation was not permitted, either current user was locked out in the case of binds,...
@ LDAP_PROC_REJECT
Bind failed, user was rejected.
@ LDAP_PROC_REFRESH_REQUIRED
Don't continue with the current refresh phase, exit, and retry the operation with a NULL cookie.
@ LDAP_PROC_BAD_DN
Specified an invalid object in a bind or search DN.
@ LDAP_PROC_NO_RESULT
Got no results.
LDAPURLDesc * ldap_url
parsed URL for current query if the source of the query was a URL.
Holds arguments for async bind auth requests.
Holds arguments for the async bind operation.
Connection configuration.
Tracks the state of a libldap connection handle.
Result of expanding the RHS of a set of maps.
Parsed LDAP referral structure.
Contains a collection of values.
Holds arguments for the async SASL bind operation.
Thread specific structure to manage LDAP trunk connections.
Thread LDAP trunk structure.
libldap global configuration data
Structure to hold parsed details of LDAP filters.
Stores all information relating to an event list.
static const conf_parser_t config[]
The main red black tree structure.
static int attr_check(CONF_SECTION *conf, tmpl_t *tmpl, char const *name, fr_dict_attr_flags_t *flags)
unlang_action_t fr_ldap_sasl_bind_auth_async(request_t *request, fr_ldap_thread_t *thread, char const *mechs, char const *identity, char const *password, char const *proxy, char const *realm)
Initiate an async SASL LDAP bind for authentication.
int fr_ldap_sasl_bind_async(fr_ldap_connection_t *c, char const *mechs, char const *identity, char const *password, char const *proxy, char const *realm, LDAPControl **serverctrls, LDAPControl **clientctrls)
Install I/O handlers for the bind operation.
int fr_ldap_sasl_bind_auth_send(fr_ldap_sasl_ctx_t *sasl_ctx, int *msgid, fr_ldap_connection_t *ldap_conn)
Send a SASL LDAP auth bind.
Optional arguments passed to vp_tmpl functions.
An element in a lexicographically sorted array of name to num mappings.
A time delta, a difference in time measured in nanoseconds.
Main trunk management handle.
Common configuration parameters for a trunk.
static fr_event_list_t * el
void fr_value_box_memdup_shallow(fr_value_box_t *dst, fr_dict_attr_t const *enumv, uint8_t const *src, size_t len, bool tainted)
Assign a buffer to a box, but don't copy it.
void fr_value_box_bstrndup_shallow(fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, size_t len, bool tainted)
Assign a string to to a fr_value_box_t.
static size_t char fr_sbuff_t size_t inlen
static size_t char ** out