The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
base.h
Go to the documentation of this file.
1 #pragma once
2 /**
3  * $Id: 172376fc8ddf3b582ac0a48639f629f42b9ae523 $
4  * @file lib/ldap/base.h
5  * @brief Common utility functions for interacting with LDAP directories
6  *
7  * @author Arran Cudbard-Bell (a.cudbardb@freeradius.org)
8  *
9  * @copyright 2017 The FreeRADIUS Server Project.
10  * @copyright 2017 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
11  */
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>
19 
20 #define LDAP_DEPRECATED 0 /* Quiet warnings about LDAP_DEPRECATED not being defined */
21 
22 #include <lber.h>
23 #include <ldap.h>
24 #include "config.h"
25 
26 extern LDAP *ldap_global_handle;
27 
28 /*
29  * Framework on OSX doesn't export the symbols but leaves
30  * the macro defined *sigh*.
31  */
32 #ifndef HAVE_LDAP_CREATE_SESSION_TRACKING_CONTROL
33 # undef LDAP_CONTROL_X_SESSION_TRACKING
34 #endif
35 
36 /*
37  * There's a typo in libldap's ldap.h which was fixed by
38  * Howard Chu in 19aeb1cd. This typo had the function defined
39  * as ldap_create_session_tracking_control but declared as
40  * ldap_create_session_tracking.
41  *
42  * We fix this, by adding the correct declaration here.
43  */
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)
46 LDAP_F( int )
47 ldap_create_session_tracking_control LDAP_P((
48  LDAP *ld,
49  char *sessionSourceIp,
50  char *sessionSourceName,
51  char *formatOID,
52  struct berval *sessionTrackingIdentifier,
53  LDAPControl **ctrlp ));
54 # endif
55 #endif
56 
57 /*
58  * Because the LTB people define LDAP_VENDOR_VERSION_PATCH
59  * as X, which precludes its use in printf statements *sigh*
60  *
61  * Identifiers that are not macros, all evaluate to 0,
62  * which is why this works.
63  */
64 #define X 0
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
68 #endif
69 #undef X
70 
71 /*
72  * For compatibility with other LDAP libraries
73  */
74 #if !defined(LDAP_SCOPE_BASE) && defined(LDAP_SCOPE_BASEOBJECT)
75 # define LDAP_SCOPE_BASE LDAP_SCOPE_BASEOBJECT
76 #endif
77 
78 #if !defined(LDAP_SCOPE_ONE) && defined(LDAP_SCOPE_ONELEVEL)
79 # define LDAP_SCOPE_ONE LDAP_SCOPE_ONELEVEL
80 #endif
81 
82 #if !defined(LDAP_SCOPE_SUB) && defined(LDAP_SCOPE_SUBTREE)
83 # define LDAP_SCOPE_SUB LDAP_SCOPE_SUBTREE
84 #endif
85 
86 #if !defined(LDAP_OPT_RESULT_CODE) && defined(LDAP_OPT_ERROR_NUMBER)
87 # define LDAP_OPT_RESULT_CODE LDAP_OPT_ERROR_NUMBER
88 #endif
89 
90 #ifndef LDAP_CONST
91 # define LDAP_CONST
92 #endif
93 
94 #define LDAP_MAX_CONTROLS 10 //!< Maximum number of client/server controls.
95  //!< Used to allocate static arrays of control pointers.
96 #define LDAP_MAX_ATTRMAP 128 //!< Maximum number of mappings between LDAP and
97  //!< FreeRADIUS attributes.
98 #define LDAP_MAP_RESERVED 5 //!< Number of additional items to allocate in expanded
99  //!< attribute name arrays. Currently for enable attribute,
100  //!< group membership attribute, valuepair attribute,
101  //!< profile attribute and profile suspend attribute.
102 
103 #define LDAP_MAX_CACHEABLE 64 //!< Maximum number of groups we retrieve from the server for
104  //!< a given user which need resolving from name to DN or DN
105  //!< to name. If more than this require resolving, the
106  //!< module returns invalid.
107 
108 #define LDAP_MAX_GROUP_NAME_LEN 128 //!< Maximum name of a group name.
109 #define LDAP_MAX_ATTR_STR_LEN 256 //!< Maximum length of an xlat expanded LDAP attribute.
110 #define LDAP_MAX_FILTER_STR_LEN 1024 //!< Maximum length of an xlat expanded filter.
111 #define LDAP_MAX_DN_STR_LEN 1024 //!< Maximum length of an xlat expanded DN.
112 
113 #define LDAP_VIRTUAL_DN_ATTR "dn" //!< 'Virtual' attribute which maps to the DN of the object.
114 
115 #define LDAP_SERVER_NOTIFICATION_OID "1.2.840.113556.1.4.528" //!< OID of Active Directory control for
116  //!< persistent search.
117 #define LDAP_SERVER_SHOW_DELETED_OID "1.2.840.113556.1.4.417" //!< OID of Active Directory control which
118  //!< enables searching for deleted objects.
119 #define LDAP_MATCHING_RULE_BIT_AND "1.2.840.113556.1.4.803" //!< OID of bit-wise AND LDAP match rule
120 #define LDAP_MATCHING_RULE_BIT_OR "1.2.840.113556.1.4.804" //!< OID of bit-wise OR LDAP match rule
121 
122 typedef enum {
123  LDAP_EXT_UNSUPPORTED, //!< Unsupported extension.
124  LDAP_EXT_BINDNAME, //!< Specifies the user DN or name for an LDAP bind.
125  LDAP_EXT_BINDPW, //!< Specifies the password for an LDAP bind.
127 
128 typedef struct {
129  char const *mech; //!< SASL mech(s) to try.
130  char const *proxy; //!< Identity to proxy.
131  char const *realm; //!< Kerberos realm.
133 
134 typedef struct {
135  LDAPControl *control; //!< LDAP control.
136  bool freeit; //!< Whether the control should be freed after
137  //!< we've finished using it.
139 
140 typedef enum {
141  FR_LDAP_DIRECTORY_UNKNOWN = 0, //!< We can't determine the directory server.
142 
143  FR_LDAP_DIRECTORY_ACTIVE_DIRECTORY, //!< Directory server is Active Directory.
144  FR_LDAP_DIRECTORY_EDIRECTORY, //!< Directory server is eDir.
145  FR_LDAP_DIRECTORY_IBM, //!< Directory server is IBM.
146  FR_LDAP_DIRECTORY_NETSCAPE, //!< Directory server is Netscape.
147  FR_LDAP_DIRECTORY_OPENLDAP, //!< Directory server is OpenLDAP.
148  FR_LDAP_DIRECTORY_ORACLE_INTERNET_DIRECTORY, //!< Directory server is Oracle Internet Directory.
149  FR_LDAP_DIRECTORY_ORACLE_UNIFIED_DIRECTORY, //!< Directory server is Oracle Unified Directory.
150  FR_LDAP_DIRECTORY_ORACLE_VIRTUAL_DIRECTORY, //!< Directory server is Oracle Virtual Directory.
151  FR_LDAP_DIRECTORY_SUN_ONE_DIRECTORY, //!< Directory server is Sun One Directory.
152  FR_LDAP_DIRECTORY_SIEMENS_AG, //!< Directory server is Siemens AG.
153  FR_LDAP_DIRECTORY_UNBOUND_ID //!< Directory server is Unbound ID
155 
156 typedef enum {
157  FR_LDAP_SYNC_NONE = 0, //!< No support for LDAP sync
158  FR_LDAP_SYNC_RFC4533, //!< Directory supports RFC 4533
159  FR_LDAP_SYNC_ACTIVE_DIRECTORY, //!< Directory supports AD style persistent search.
160  FR_LDAP_SYNC_PERSISTENT_SEARCH //!< Directory supports persistent search
162 
163 /** LDAP connection handle states
164  *
165  */
166 typedef enum {
167  FR_LDAP_STATE_INIT = 0, //!< Connection uninitialised.
168  FR_LDAP_STATE_START_TLS, //!< TLS is being negotiated.
169  FR_LDAP_STATE_BIND, //!< Connection is being bound.
170  FR_LDAP_STATE_RUN, //!< Connection is muxing/demuxing requests.
171  FR_LDAP_STATE_ERROR //!< Connection is in an error state.
173 
174 /** Types of LDAP requests
175  *
176  */
177 typedef enum {
178  LDAP_REQUEST_SEARCH = 1, //!< A lookup in an LDAP directory
179  LDAP_REQUEST_MODIFY, //!< A modification to an LDAP entity
180  LDAP_REQUEST_EXTENDED //!< An extended LDAP operation
182 
183 /** LDAP query result codes
184  *
185  */
186 typedef enum {
187  LDAP_RESULT_PENDING = 1, //!< Result not yet returned
188  LDAP_RESULT_SUCCESS = 0, //!< Successfully got LDAP results
189  LDAP_RESULT_ERROR = -1, //!< A general error occurred
190  LDAP_RESULT_TIMEOUT = -2, //!< The query timed out
191  LDAP_RESULT_BAD_DN = -3, //!< The requested DN does not exist
192  LDAP_RESULT_NO_RESULT = -4, //!< No results returned
193  LDAP_RESULT_REFERRAL_FAIL = -5, //!< Initial results indicated a referral was needed
194  ///< but the referral could not be followed
195  LDAP_RESULT_EXCESS_REFERRALS = -6, //!< The referral chain took too many hops
196  LDAP_RESULT_MISSING_REFERRAL = -7, //!< A referral was indicated but no URL was provided
198 
199 typedef struct {
200  char const *vendor_str; //!< As returned from the vendorName attribute in the
201  ///< rootDSE.
202  char const *version_str; //!< As returned from the vendorVersion attribute in the
203  ///< rootDSE.
204  fr_ldap_directory_type_t type; ///< Canonical server implementation.
205 
206  bool cleartext_password; //!< Whether the server will return the user's plaintext
207  ///< password.
208 
209  fr_ldap_sync_type_t sync_type; //!< What kind of LDAP sync this directory supports.
210 
211  char const **naming_contexts; //!< Databases served by this directory.
213 
214 /** Connection configuration
215  *
216  * Must not be passed into functions except via the connection handle
217  * this avoids problems with not using the connection pool configuration.
218  */
219 typedef struct {
220  char const *name; //!< Name of the module that created this connection.
221 
222  char *server; //!< Initial server to bind to.
223  char const **server_str; //!< Server set in the config.
224 
225  uint16_t port; //!< Port to use when binding to the server.
226 
227  char const *admin_identity; //!< Identity we bind as when we need to query the LDAP
228  ///< directory.
229  char const *admin_password; //!< Password used in administrative bind.
230 
231  fr_ldap_sasl_t admin_sasl; //!< SASL parameters used when binding as the admin.
232 
233  const char *sasl_secprops; //!< SASL Security Properties to set.
234 
235  int dereference; //!< libldap value specifying dereferencing behaviour.
236  char const *dereference_str; //!< When to dereference (never, searching, finding, always)
237 
238  bool chase_referrals; //!< If the LDAP server returns a referral to another server
239  ///< or point in the tree, follow it, establishing new
240  ///< connections and binding where necessary.
241  bool chase_referrals_unset; //!< If true, use the OpenLDAP defaults for chase_referrals.
242 
243  bool use_referral_credentials; //!< If true use credentials from the referral URL.
244 
245  uint16_t referral_depth; //!< How many referrals to chase
246 
247  bool rebind; //!< If use_referral_credentials is false, controls whether we
248  ///< bind as our admin credentials (true) or anonymously (false)
249  ///< when connecting to a different server to follow a referral
250 
251  /*
252  * TLS items.
253  */
254  int tls_mode;
255 
256  bool start_tls; //!< Send the Start TLS message to the LDAP directory
257  ///< to start encrypted communications using the standard
258  ///< LDAP port.
259 
260  char const *tls_ca_file; //!< Sets the full path to a CA certificate (used to validate
261  ///< the certificate the server presents).
262 
263  char const *tls_ca_path; //!< Sets the path to a directory containing CA certificates.
264 
265  char const *tls_certificate_file; //!< Sets the path to the public certificate file we present
266  ///< to the servers.
267 
268  char const *tls_private_key_file; //!< Sets the path to the private key for our public
269  ///< certificate.
270 
271  char const *tls_require_cert_str; //!< Sets requirements for validating the certificate the
272  ///< server presents.
273 
274  int tls_require_cert; //!< OpenLDAP constant representing the require cert string.
275 
276  char const *tls_min_version_str; //!< Minimum TLS version
278 
279  /*
280  * For keep-alives.
281  */
282  fr_time_delta_t keepalive_idle; //!< Number of seconds a connections needs to remain idle
283  //!< before TCP starts sending keepalive probes.
284 
285  uint32_t keepalive_probes; //!< Number of missed timeouts before the connection is
286  ///< dropped.
287 
288  fr_time_delta_t keepalive_interval; //!< Interval between keepalive probes.
289 
290  /*
291  * Search timelimits
292  */
293  fr_time_delta_t srv_timelimit; //!< How long the server should spent on a single request
294  ///< (also bounded by value on the server).
295 
296  fr_time_delta_t res_timeout; //!< How long we wait for results.
297 
298  /*
299  * I/O timelimits.
300  */
301  fr_time_delta_t net_timeout; //!< How long we wait in blocking network calls.
302  ///< We set this in the LDAP API, even though with
303  ///< async calls, we control this using our event loop.
304  ///< This is just in case there are blocking calls which
305  ///< happen internally which we can't work around.
306 
307  fr_time_delta_t tls_handshake_timeout; //!< How long we wait for the TLS handshake to complete.
308 
309  fr_time_delta_t reconnection_delay; //!< How long to wait before attempting to reconnect.
310 
311  fr_time_delta_t idle_timeout; //!< How long to wait before closing unused connections.
313 
314 /** libldap global configuration data
315  *
316  */
317 typedef struct {
318  uint32_t ldap_debug; //!< LDAP debug level
319  char const *tls_random_file; //!< Path to the ramdon file if /dev/random and /dev/urandom
320  //!< are unavailable
322 
324 
326 
327 /** Tracks the state of a libldap connection handle
328  *
329  */
330 typedef struct {
331  LDAP *handle; //!< libldap handle.
332 
333  fr_ldap_control_t serverctrls[LDAP_MAX_CONTROLS + 1]; //!< Server controls to use for all operations
334  ///< with this handle.
335  fr_ldap_control_t clientctrls[LDAP_MAX_CONTROLS + 1]; //!< Client controls to use for all operations
336  ///< with this handle.
337  int serverctrls_cnt; //!< Number of server controls associated with the handle.
338  int clientctrls_cnt; //!< Number of client controls associated with the handle.
339 
340  fr_ldap_directory_t *directory; //!< The type of directory we're connected to.
341 
342  fr_ldap_config_t const *config; //!< rlm_ldap connection configuration.
343  fr_connection_t *conn; //!< Connection state handle.
344 
345  fr_ldap_state_t state; //!< LDAP connection state machine.
346 
347  int fd; //!< File descriptor for this connection.
348 
349  fr_rb_tree_t *queries; //!< Outstanding queries on this connection
350  fr_dlist_head_t refs; //!< Replied to queries still referencing this connection.
351 
352  void *uctx; //!< User data associated with the handle.
354 
355 /** Contains a collection of values
356  *
357  */
358 typedef struct {
359  struct berval **values; //!< libldap struct containing bv_val (char *)
360  ///< and length bv_len.
361  int count; //!< Number of values.
363 
364 /** Result of expanding the RHS of a set of maps
365  *
366  * Used to store the array of attributes we'll be querying for.
367  */
368 typedef struct {
369  map_list_t const *maps; //!< Head of list of maps we expanded the RHS of.
370  char const *attrs[LDAP_MAX_ATTRMAP + LDAP_MAP_RESERVED + 1]; //!< Reserve some space for access attributes
371  //!< and NULL termination.
372  TALLOC_CTX *ctx; //!< Context to allocate new attributes in.
373  int count; //!< Index on next free element.
375 
376 /** Thread specific structure to manage LDAP trunk connections.
377  *
378  */
379 typedef struct {
380  fr_rb_tree_t *trunks; //!< Tree of LDAP trunks used by this thread
381  fr_ldap_config_t *config; //!< Module instance config
382  fr_trunk_conf_t *trunk_conf; //!< Module trunk config
383  fr_trunk_conf_t *bind_trunk_conf; //!< Trunk config for bind auth trunk
384  fr_event_list_t *el; //!< Thread event list for callbacks / timeouts
385  fr_ldap_thread_trunk_t *bind_trunk; //!< LDAP trunk used for bind auths
386  fr_rb_tree_t *binds; //!< Tree of outstanding bind auths
388 
389 /** Thread LDAP trunk structure
390  *
391  * One fr_ldap_thread_trunk_t will be allocated for each destination a thread needs
392  * to create an LDAP trunk connection to.
393  *
394  * Used to hold config regarding the LDAP connection and associate pending queries
395  * with the trunk they are running on.
396  */
397 typedef struct fr_ldap_thread_trunk_s {
398  fr_rb_node_t node; //!< Entry in the tree of connections
399  char const *uri; //!< Server URI for this connection
400  char const *bind_dn; //!< DN connection is bound as
401  fr_ldap_config_t config; //!< Config used for this connection
402  fr_ldap_directory_t *directory; //!< The type of directory we're connected to.
403  fr_trunk_t *trunk; //!< Connection trunk
404  fr_ldap_thread_t *t; //!< Thread this connection is associated with
405  fr_event_timer_t const *ev; //!< Event to close the thread when it has been idle.
407 
409 
410 typedef struct fr_ldap_query_s fr_ldap_query_t;
411 
412 typedef void (*fr_ldap_result_parser_t)(LDAP *handle, fr_ldap_query_t *query, LDAPMessage *head, void *rctx);
413 
414 /** LDAP query structure
415  *
416  * Used to hold the elements of an LDAP query and track its progress.
417  * libldap structures will be freed by the talloc destructor.
418  * The same structure is used both for search queries and modifications
419  */
421  fr_rb_node_t node; //!< Entry in the tree of outstanding queries.
422  fr_dlist_t entry; //!< Entry in the list of connection references.
423 
424  LDAPURLDesc *ldap_url; //!< parsed URL for current query if the source
425  ///< of the query was a URL.
426 
427  char const *dn; //!< Base DN for searches, DN for modifications.
428 
429  union {
430  struct {
431  char const **attrs; //!< Attributes being requested in a search.
432  int scope; //!< Search scope.
433  char const *filter; //!< Filter for search.
434  } search;
435  struct {
436  char const *reqoid; //!< OID of extended operation to perform.
437  struct berval *reqdata; //!< Data required for the request.
438  } extended;
439  LDAPMod **mods; //!< Changes to be applied if this query is a modification.
440  };
441 
442  fr_ldap_request_type_t type; //!< What type of query this is.
443 
444  fr_ldap_control_t serverctrls[LDAP_MAX_CONTROLS]; //!< Server controls specific to this query.
445  fr_ldap_control_t clientctrls[LDAP_MAX_CONTROLS]; //!< Client controls specific to this query.
446 
447 
448  int msgid; //!< The unique identifier for this query.
449  ///< Uniqueness is only per connection.
450 
451  fr_trunk_request_t *treq; //!< Trunk request this query is associated with
452  fr_ldap_connection_t *ldap_conn; //!< LDAP connection this query is running on.
453 
454  fr_event_timer_t const *ev; //!< Event for timing out the query
455 
456  char **referral_urls; //!< Referral results to follow
457  fr_dlist_head_t referrals; //!< List of parsed referrals
458  uint16_t referral_depth; //!< How many referrals we have followed
459  fr_ldap_referral_t *referral; //!< Referral actually being followed
460 
461  fr_ldap_result_parser_t parser; //!< Custom results parser.
462 
463  LDAPMessage *result; //!< Head of LDAP results list.
464 
465  fr_ldap_result_code_t ret; //!< Result code
466 };
467 
468 /** Parsed LDAP referral structure
469  *
470  * When LDAP servers respond with a referral, it is parsed into one or more fr_ldap_referral_t
471  * and kept until the referral has been followed.
472  * Avoids repeated parsing of the referrals as provided by libldap.
473  */
474 typedef struct fr_ldap_referral_s {
475  fr_dlist_t entry; //!< Entry in list of possible referrals
476  fr_ldap_query_t *query; //!< Query this referral relates to
477  LDAPURLDesc *referral_url; //!< URL for the referral
478  char *host_uri; //!< Host URI used for referral connection
479  char const *identity; //!< Bind identity for referral connection
480  char const *password; //!< Bind password for referral connection
481  fr_ldap_thread_trunk_t *ttrunk; //!< Trunk this referral should use
482  request_t *request; //!< Request this referral relates to
484 
485 /** Holds arguments for the async bind operation
486  *
487  */
488 typedef struct {
489  fr_ldap_connection_t *c; //!< to bind. Only used when binding as admin user.
490  char const *bind_dn; //!< of the user, may be NULL to bind anonymously.
491  char const *password; //!< of the user, may be NULL if no password is specified.
492  LDAPControl **serverctrls; //!< Controls to pass to the server.
493  LDAPControl **clientctrls; //!< Controls to pass to the client (library).
494 
495  int msgid; //!< Of the bind operation. Only used when binding as admin.
497 
498 /** Holds arguments for the async SASL bind operation
499  *
500  */
501 typedef struct {
502  fr_ldap_connection_t *c; //!< to bind. Only used when binding as admin user.
503  char const *mechs; //!< SASL mechanisms to run
504  char const *identity; //!< of the user.
505  char const *password; //!< of the user, may be NULL if no password is specified.
506  char const *proxy; //!< Proxy identity, may be NULL in which case identity is used.
507  char const *realm; //!< SASL realm (may be NULL).
508  LDAPControl **serverctrls; //!< Controls to pass to the server.
509  LDAPControl **clientctrls; //!< Controls to pass to the client (library).
510 
511  int msgid; //!< Last msgid. Only used when binding as admin user.
512  LDAPMessage *result; //!< Previous result.
513  char const *rmech; //!< Mech we're continuing with.
515 
516 typedef enum {
518 #ifdef WITH_SASL
519  LDAP_BIND_SASL
520 #endif
522 
523 typedef struct ldap_filter_s ldap_filter_t;
524 
525 /** Types of parsed LDAP filter nodes
526  */
527 typedef enum {
528  LDAP_FILTER_NODE = 0, //!< The filter node is an individual one
529  //!< to be evaluated against an attribute.
530  LDAP_FILTER_GROUP //!< The filter node is a parent of a group
531  //!< which will be combined using a logical operator.
533 
534 /** Logical operators for use in LDAP filters
535  */
536 typedef enum {
541 
542 /** Operators for use in LDAP filters
543  */
544 typedef enum {
545  LDAP_FILTER_OP_UNSET = 0, //!< Attribute not set yet
546  LDAP_FILTER_OP_EQ, //!< Attribute equals value
547  LDAP_FILTER_OP_SUBSTR, //!< Attribute matches string with wildcards
548  LDAP_FILTER_OP_PRESENT, //!< Attribute present
549  LDAP_FILTER_OP_GE, //!< Attribute greater than or equal to value
550  LDAP_FILTER_OP_LE, //!< Attribute less than or equal to value
551  LDAP_FILTER_OP_BIT_AND, //!< Bitwise AND comparison
552  LDAP_FILTER_OP_BIT_OR //!< Bitwise OR comparison
554 
555 /** Structure to hold parsed details of LDAP filters
556  */
558  fr_dlist_t entry; //!< Entry in the list of filter nodes.
559  ldap_filter_type_t filter_type; //!< Type of this filter node.
560  char *orig; //!< Text representation of filter for debug messages,
561  union {
562  struct {
563  ldap_filter_logic_t logic_op; //!< Logical operator for this group.
564  fr_dlist_head_t children; //!< List of child nodes in this group.
565  };
566  struct {
567  char *attr; //!< Attribute for the filter node.
568  ldap_filter_op_t op; //!< Operator to be used for comparison.
569  fr_value_box_t *value; //!< Value to compare with.
570  };
571  };
572 };
573 
574 /** Codes returned by fr_ldap internal functions
575  *
576  */
577 typedef enum {
578  LDAP_PROC_REFERRAL = 2, //!< LDAP server returned referral URLs.
579  LDAP_PROC_CONTINUE = 1, //!< Operation is in progress.
580  LDAP_PROC_SUCCESS = 0, //!< Operation was successful.
581 
582  LDAP_PROC_ERROR = -1, //!< Unrecoverable library/server error.
583 
584  LDAP_PROC_BAD_CONN = -2, //!< Transitory error, caller should retry the operation
585  //!< with a new connection.
586 
587  LDAP_PROC_NOT_PERMITTED = -3, //!< Operation was not permitted, either current user was
588  //!< locked out in the case of binds, or has insufficient
589  //!< access.
590 
591  LDAP_PROC_REJECT = -4, //!< Bind failed, user was rejected.
592 
593  LDAP_PROC_BAD_DN = -5, //!< Specified an invalid object in a bind or search DN.
594 
595  LDAP_PROC_NO_RESULT = -6, //!< Got no results.
596 
597  LDAP_PROC_TIMEOUT = -7, //!< Operation timed out.
598 
599  LDAP_PROC_REFRESH_REQUIRED = -8 //!< Don't continue with the current refresh phase,
600  //!< exit, and retry the operation with a NULL cookie.
602 
603 /** Holds arguments for async bind auth requests
604  *
605  * Used when LDAP binds are being used to authenticate users, rather than admin binds.
606  * Allows tracking of multiple bind requests on a single connection.
607  */
608 typedef struct {
609  fr_rb_node_t node; //!< Entry in the tree of outstanding bind requests.
610  fr_ldap_thread_t *thread; //!< This bind is being run by.
611  fr_trunk_request_t *treq; //!< Trunk request this bind is associated with.
612  int msgid; //!< libldap msgid for this bind.
613  request_t *request; //!< this bind relates to.
614  fr_ldap_bind_type_t type; //!< type of bind.
615  union {
616  fr_ldap_bind_ctx_t *bind_ctx; //!< User data for simple binds.
617  fr_ldap_sasl_ctx_t *sasl_ctx; //!< User data for SASL binds.
618  };
619  fr_ldap_rcode_t ret; //!< Return code of bind operation.
621 
622 /*
623  * Tables for resolving strings to LDAP constants
624  */
626 extern size_t fr_ldap_connection_states_len;
627 
631 extern size_t fr_ldap_dereference_len;
632 extern fr_table_num_sorted_t const fr_ldap_scope[];
633 extern size_t fr_ldap_scope_len;
635 extern size_t fr_ldap_tls_require_cert_len;
636 
637 /** Inline function to copy pointers from a berval to a valuebox
638  *
639  * @note This results in a shallow copy of the berval, so if the berval is freed
640  * the value box becomes invalidated.
641  *
642  * @param[out] value to write berval values to.
643  * @param[in] berval to copy pointers/lengths from.
644  */
645 static inline void fr_ldap_berval_to_value_shallow(fr_value_box_t *value, struct berval *berval)
646 {
647  fr_value_box_memdup_shallow(value, NULL, (uint8_t *)berval->bv_val, berval->bv_len, true);
648 }
649 
650 /** Inline function to copy pointer from a berval to a string value box
651  *
652  * Useful for printing contents of bervals known to contain strings in DEBUG output since
653  * they are not NULL terminated.
654  *
655  * @note This results in a shallow copy of the berval, so if the berval is freed
656  * the value box becomes invalidated.
657  *
658  * @param[out] value to write berval value to.
659  * @param[in] berval top copy pointer / length from.
660  */
661 static inline void fr_ldap_berval_to_value_str_shallow(fr_value_box_t *value, struct berval *berval)
662 {
663  fr_value_box_bstrndup_shallow(value, NULL, berval->bv_val, berval->bv_len, true);
664 }
665 
666 /** Compare a berval with a C string of a known length using case insensitive comparison
667  *
668  * @param[in] value berval.
669  * @param[in] str String to compare with value.
670  * @param[in] strlen Number of characters of str to compare.
671  */
672 static inline int fr_ldap_berval_strncasecmp(struct berval *value, char const *str, size_t strlen)
673 {
674  size_t i;
675  if (strlen != value->bv_len) return CMP(strlen, value->bv_len);
676 
677  for (i = 0; i < strlen; i++) {
678  if (tolower(value->bv_val[i]) != tolower(str[i])) return CMP(value->bv_val[i], str[i]);
679  }
680 
681  return 0;
682 }
683 
684 /** Compare two ldap trunk structures on connection URI / DN
685  *
686  * @param[in] one first connection to compare.
687  * @param[in] two second connection to compare.
688  * @return CMP(one, two)
689  */
690 static inline int8_t fr_ldap_trunk_cmp(void const *one, void const *two)
691 {
692  fr_ldap_thread_trunk_t const *a = one, *b = two;
693  int8_t uricmp = CMP(strcmp(a->uri, b->uri), 0);
694 
695  if (uricmp !=0) return uricmp;
696  if (!a->bind_dn || !b->bind_dn) return CMP(a->bind_dn, b->bind_dn);
697  return CMP(strcmp(a->bind_dn, b->bind_dn), 0);
698 }
699 
700 /** Compare two ldap query structures on msgid
701  *
702  * @param[in] one first query to compare.
703  * @param[in] two second query to compare.
704  * @return CMP(one,two)
705  */
706 static inline int8_t fr_ldap_query_cmp(void const *one, void const *two)
707 {
708  fr_ldap_query_t const *a = one, *b = two;
709 
710  return CMP(a->msgid, b->msgid);
711 }
712 
713 /** Compare two ldap bind auth structures on msgid
714  *
715  * @param[in] one first bind request to compare.
716  * @param[in] two second bind request to compare.
717  * @return CMP(one,two)
718  */
719 static inline int8_t fr_ldap_bind_auth_cmp(void const *one, void const *two)
720 {
721  fr_ldap_bind_auth_ctx_t const *a = one, *b = two;
722 
723  return CMP(a->msgid, b->msgid);
724 }
725 
726 fr_ldap_query_t *fr_ldap_search_alloc(TALLOC_CTX *ctx,
727  char const *base_dn, int scope, char const *filter, char const * const * attrs,
728  LDAPControl **serverctrls, LDAPControl **clientctrls);
729 
730 fr_ldap_query_t *fr_ldap_modify_alloc(TALLOC_CTX *ctx, char const *dn,
731  LDAPMod *mods[], LDAPControl **serverctrls, LDAPControl **clientctrls);
732 
733 fr_ldap_query_t *fr_ldap_extended_alloc(TALLOC_CTX *ctx, char const *reqiod, struct berval *reqdata,
734  LDAPControl **serverctrls, LDAPControl **clientctrls);
735 
736 unlang_action_t fr_ldap_trunk_search(TALLOC_CTX *ctx,
738  char const *base_dn, int scope, char const *filter, char const * const *attrs,
739  LDAPControl **serverctrls, LDAPControl **clientctrls);
740 
741 unlang_action_t fr_ldap_trunk_modify(TALLOC_CTX *ctx,
743  char const *dn, LDAPMod *mods[],
744  LDAPControl **serverctrls, LDAPControl **clientctrls);
745 
748  char const *reqoid, struct berval *reqdata,
749  LDAPControl **serverctrls, LDAPControl **clientctrls);
750 
751 /*
752  * base.c - Wrappers arounds OpenLDAP functions.
753  */
754 void fr_ldap_timeout_debug(request_t *request, fr_ldap_connection_t const *conn,
755  fr_time_delta_t timeout, char const *prefix);
756 
757 size_t fr_ldap_uri_escape_func(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
758  CC_HINT(nonnull(2,4));
759 
760 size_t fr_ldap_uri_unescape_func(UNUSED request_t *request, char *out, size_t outlen, char const *in, UNUSED void *arg)
761  CC_HINT(nonnull(2,4));
762 
763 char const *fr_ldap_error_str(fr_ldap_connection_t const *conn);
764 
765 fr_ldap_rcode_t fr_ldap_search_async(int *msgid, request_t *request,
766  fr_ldap_connection_t *pconn,
767  char const *dn, int scope, char const *filter, char const * const *attrs,
768  LDAPControl **serverctrls, LDAPControl **clientctrls);
769 
771  char const *dn, LDAPMod *mods[],
772  LDAPControl **serverctrls, LDAPControl **clientctrls);
773 
775  char const *reqiod, struct berval *reqdata);
776 
777 fr_ldap_rcode_t fr_ldap_error_check(LDAPControl ***ctrls, fr_ldap_connection_t const *conn,
778  LDAPMessage *msg, char const *dn);
779 
780 fr_ldap_rcode_t fr_ldap_result(LDAPMessage **result, LDAPControl ***ctrls,
781  fr_ldap_connection_t const *conn, int msgid, int all,
782  char const *dn,
784 
785 LDAP *fr_ldap_handle_thread_local(void);
786 
787 int fr_ldap_global_config(int debug_level, char const *tls_random_file);
788 
789 int fr_ldap_init(void);
790 
791 void fr_ldap_free(void);
792 
793 /*
794  * control.c - Connection based client/server controls
795  */
796 void fr_ldap_control_merge(LDAPControl *serverctrls_out[],
797  LDAPControl *clientctrls_out[],
798  size_t serverctrls_len,
799  size_t clientctrls_len,
800  fr_ldap_connection_t *conn,
801  LDAPControl *serverctrls_in[],
802  LDAPControl *clientctrls_in[]);
803 
804 int fr_ldap_control_add_server(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit);
805 
806 int fr_ldap_control_add_client(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit);
807 
809 
811 
812 /*
813  * directory.c - Get directory capabilities from the remote server
814  */
815 #define LDAP_DIRECTORY_ATTRS { "vendorname", \
816  "vendorversion", \
817  "isGlobalCatalogReady", \
818  "objectClass", \
819  "orcldirectoryversion", \
820  "supportedControl", \
821  "namingContexts", \
822  NULL }
823 
824 int fr_ldap_directory_result_parse(fr_ldap_directory_t *directory, LDAP *handle,
825  LDAPMessage *result, char const *name);
826 
827 int fr_ldap_trunk_directory_alloc_async(TALLOC_CTX *ctx, fr_ldap_thread_trunk_t *ttrunk);
828 
830 
831 /*
832  * edir.c - Edirectory integrations
833  */
834 unlang_action_t fr_ldap_edir_get_password(request_t *request, char const *dn,
835  fr_ldap_thread_trunk_t *ttrunk, fr_dict_attr_t const *password_da);
836 
837 char const *fr_ldap_edir_errstr(int code);
838 
839 
840 /*
841  * map.c - Attribute mapping code.
842  */
843 int fr_ldap_map_getvalue(TALLOC_CTX *ctx, fr_pair_list_t *out, request_t *request,
844  map_t const *map, void *uctx);
845 
846 int fr_ldap_map_verify(map_t *map, void *instance);
847 
848 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);
849 
850 int fr_ldap_map_do(request_t *request,
851  char const *valuepair_attr, fr_ldap_map_exp_t const *expanded, LDAPMessage *entry);
852 
853 /*
854  * connection.c - Connection configuration functions
855  */
857 
859  fr_ldap_config_t const *config, char const *log_prefix);
860 
862 
864 
866 
868  char const *bind_dn, char const *bind_password,
869  request_t *request, fr_ldap_config_t const *config);
870 
871 fr_trunk_state_t fr_thread_ldap_trunk_state(fr_ldap_thread_t *thread, char const *uri, char const *bind_dn);
872 
874 
875 /*
876  * state.c - Connection state machine
877  */
879 
881 
882 /*
883  * start_tls.c - Mostly async start_tls
884  */
886  LDAPControl **serverctrls, LDAPControl **clientctrls);
887 
888 /*
889  * sasl.c - Async sasl bind
890  */
891 #ifdef WITH_SASL
893  char const *mechs,
894  char const *identity,
895  char const *password,
896  char const *proxy,
897  char const *realm,
898  LDAPControl **serverctrls, LDAPControl **clientctrls);
899 
901  int *msgid,
902  fr_ldap_connection_t *ldap_conn);
903 
905  fr_ldap_thread_t *thread,
906  char const *mechs,
907  char const *identity,
908  char const *password,
909  char const *proxy, char const *realm);
910 #endif
911 
912 /*
913  * bind.c - Async bind
914  */
916  char const *bind_dn, char const *password,
917  LDAPControl **serverctrls, LDAPControl **clientctrls);
918 
920  char const *bind_dn, char const *password);
921 
922 /*
923  * uti.c - Utility functions
924  */
925 size_t fr_ldap_common_dn(char const *full, char const *part);
926 
927 bool fr_ldap_util_is_dn(char const *in, size_t inlen);
928 
929 size_t fr_ldap_util_normalise_dn(char *out, char const *in);
930 
931 char *fr_ldap_berval_to_string(TALLOC_CTX *ctx, struct berval const *in);
932 
933 uint8_t *fr_ldap_berval_to_bin(TALLOC_CTX *ctx, struct berval const *in);
934 
935 int fr_ldap_parse_url_extensions(LDAPControl **sss, size_t sss_len, char *extensions[]);
936 
937 int fr_ldap_attrs_check(char const **attrs, char const *attr);
938 
939 int fr_ldap_server_url_check(fr_ldap_config_t *handle_config, char const *server, CONF_SECTION const *cs);
940 
941 int fr_ldap_server_config_check(fr_ldap_config_t *handle_config, char const *server, CONF_SECTION *cs);
942 
943 char const *fr_ldap_url_err_to_str(int ldap_url_err);
944 
945 int fr_ldap_box_escape(fr_value_box_t *vb, UNUSED void *uctx);
946 
947 int fr_ldap_filter_to_tmpl(TALLOC_CTX *ctx, tmpl_rules_t const *t_rules, char const **sub, size_t sublen,
948  tmpl_t **out) CC_HINT(nonnull());
949 
950 /*
951  * referral.c - Handle LDAP referrals
952  */
953 fr_ldap_referral_t *fr_ldap_referral_alloc(TALLOC_CTX *ctx, request_t *request);
954 
956 
957 int fr_ldap_referral_next(fr_ldap_thread_t *thread, request_t *request, fr_ldap_query_t *query);
958 
959 /*
960  * filter.c - Basic filter parsing and filtering
961  */
962 typedef int (*filter_attr_check_t)(char const *attr, void *uctx);
963 
964 fr_slen_t fr_ldap_filter_parse(TALLOC_CTX *ctx, fr_dlist_head_t **root, fr_sbuff_t *filter,
965  filter_attr_check_t attr_check, void *uctx);
966 
967 bool fr_ldap_filter_eval(fr_dlist_head_t *root, fr_ldap_connection_t *conn, LDAPMessage *msg);
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
log_entry msg
Definition: acutest.h:794
#define CMP(_a, _b)
Same as CMP_PREFER_SMALLER use when you don't really care about ordering, you just want an ordering.
Definition: build.h:110
#define UNUSED
Definition: build.h:313
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:89
static fr_time_delta_t timeout
Definition: dhcpclient.c:54
static fr_slen_t in
Definition: dict.h:645
Test enumeration values.
Definition: dict_test.h:92
Head of a doubly linked list.
Definition: dlist.h:51
Entry in a doubly linked list.
Definition: dlist.h:41
Structure to define how to initialise libraries with global configuration.
Definition: global_lib.h:38
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.
Definition: util.c:164
size_t fr_ldap_util_normalise_dn(char *out, char const *in)
Normalise escape sequences in a DN.
Definition: util.c:439
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.
Definition: map.c:39
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.
Definition: base.h:645
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.
Definition: util.c:70
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.
Definition: base.c:232
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.
Definition: filter.c:343
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.
Definition: util.c:517
char const * mech
SASL mech(s) to try.
Definition: base.h:129
struct berval ** values
libldap struct containing bv_val (char *) and length bv_len.
Definition: base.h:359
char const * proxy
Proxy identity, may be NULL in which case identity is used.
Definition: base.h:506
fr_ldap_control_t serverctrls[LDAP_MAX_CONTROLS]
Server controls specific to this query.
Definition: base.h:444
LDAP * ldap_global_handle
Hack for OpenLDAP libldap global initialisation.
Definition: base.c:39
LDAPURLDesc * referral_url
URL for the referral.
Definition: base.h:477
LDAPControl ** clientctrls
Controls to pass to the client (library).
Definition: base.h:493
LDAP * fr_ldap_handle_thread_local(void)
Get a thread local dummy LDAP handle.
Definition: base.c:1051
uint8_t * fr_ldap_berval_to_bin(TALLOC_CTX *ctx, struct berval const *in)
Convert a berval to a talloced buffer.
Definition: util.c:409
int fr_ldap_conn_directory_alloc_async(fr_ldap_connection_t *ldap_conn)
Async extract useful information from the rootDSE of the LDAP server.
Definition: directory.c:283
size_t fr_ldap_dereference_len
Definition: base.c:92
fr_ldap_thread_t * t
Thread this connection is associated with.
Definition: base.h:404
char const * tls_private_key_file
Sets the path to the private key for our public certificate.
Definition: base.h:268
fr_dlist_t entry
Entry in the list of connection references.
Definition: base.h:422
fr_trunk_request_t * treq
Trunk request this query is associated with.
Definition: base.h:451
char const * proxy
Identity to proxy.
Definition: base.h:130
fr_time_delta_t res_timeout
How long we wait for results.
Definition: base.h:296
ldap_filter_logic_t
Logical operators for use in LDAP filters.
Definition: base.h:536
@ LDAP_FILTER_LOGIC_NOT
Definition: base.h:539
@ LDAP_FILTER_LOGIC_OR
Definition: base.h:538
@ LDAP_FILTER_LOGIC_AND
Definition: base.h:537
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.
Definition: base.c:528
fr_ldap_rcode_t ret
Return code of bind operation.
Definition: base.h:619
char * host_uri
Host URI used for referral connection.
Definition: base.h:478
char const * admin_password
Password used in administrative bind.
Definition: base.h:229
fr_ldap_state_t state
LDAP connection state machine.
Definition: base.h:345
fr_ldap_config_t * config
Module instance config.
Definition: base.h:381
void fr_ldap_control_clear(fr_ldap_connection_t *conn)
Clear and free any controls associated with a connection.
Definition: control.c:134
size_t fr_ldap_scope_len
Definition: base.c:75
int count
Index on next free element.
Definition: base.h:373
fr_event_timer_t const * ev
Event for timing out the query.
Definition: base.h:454
bool chase_referrals
If the LDAP server returns a referral to another server or point in the tree, follow it,...
Definition: base.h:238
fr_table_num_sorted_t const fr_ldap_supported_extensions[]
Definition: base.c:60
bool fr_ldap_util_is_dn(char const *in, size_t inlen)
Check whether a string looks like a DN.
Definition: util.c:211
char ** referral_urls
Referral results to follow.
Definition: base.h:456
fr_ldap_directory_type_t
Definition: base.h:140
@ FR_LDAP_DIRECTORY_ORACLE_UNIFIED_DIRECTORY
Directory server is Oracle Unified Directory.
Definition: base.h:149
@ FR_LDAP_DIRECTORY_UNKNOWN
We can't determine the directory server.
Definition: base.h:141
@ FR_LDAP_DIRECTORY_NETSCAPE
Directory server is Netscape.
Definition: base.h:146
@ FR_LDAP_DIRECTORY_EDIRECTORY
Directory server is eDir.
Definition: base.h:144
@ FR_LDAP_DIRECTORY_ORACLE_INTERNET_DIRECTORY
Directory server is Oracle Internet Directory.
Definition: base.h:148
@ FR_LDAP_DIRECTORY_UNBOUND_ID
Directory server is Unbound ID.
Definition: base.h:153
@ FR_LDAP_DIRECTORY_SIEMENS_AG
Directory server is Siemens AG.
Definition: base.h:152
@ FR_LDAP_DIRECTORY_ORACLE_VIRTUAL_DIRECTORY
Directory server is Oracle Virtual Directory.
Definition: base.h:150
@ FR_LDAP_DIRECTORY_ACTIVE_DIRECTORY
Directory server is Active Directory.
Definition: base.h:143
@ FR_LDAP_DIRECTORY_OPENLDAP
Directory server is OpenLDAP.
Definition: base.h:147
@ FR_LDAP_DIRECTORY_SUN_ONE_DIRECTORY
Directory server is Sun One Directory.
Definition: base.h:151
@ FR_LDAP_DIRECTORY_IBM
Directory server is IBM.
Definition: base.h:145
int msgid
libldap msgid for this bind.
Definition: base.h:612
int fr_ldap_global_config(int debug_level, char const *tls_random_file)
Change settings global to libldap.
Definition: base.c:1071
map_list_t const * maps
Head of list of maps we expanded the RHS of.
Definition: base.h:369
char const * fr_ldap_error_str(fr_ldap_connection_t const *conn)
Return the error string associated with a handle.
Definition: base.c:210
size_t fr_ldap_common_dn(char const *full, char const *part)
Find the place at which the two DN strings diverge.
Definition: util.c:488
char const * tls_certificate_file
Sets the path to the public certificate file we present to the servers.
Definition: base.h:265
char * server
Initial server to bind to.
Definition: base.h:222
static int8_t fr_ldap_bind_auth_cmp(void const *one, void const *two)
Compare two ldap bind auth structures on msgid.
Definition: base.h:719
int dereference
libldap value specifying dereferencing behaviour.
Definition: base.h:235
fr_ldap_sync_type_t sync_type
What kind of LDAP sync this directory supports.
Definition: base.h:209
uint16_t referral_depth
How many referrals we have followed.
Definition: base.h:458
LDAP * handle
libldap handle.
Definition: base.h:331
int msgid
The unique identifier for this query.
Definition: base.h:448
char const * dn
Base DN for searches, DN for modifications.
Definition: base.h:427
char const * bind_dn
DN connection is bound as.
Definition: base.h:400
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.
Definition: connection.c:993
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.
Definition: control.c:48
fr_rb_node_t node
Entry in the tree of connections.
Definition: base.h:398
int serverctrls_cnt
Number of server controls associated with the handle.
Definition: base.h:337
fr_dlist_head_t referrals
List of parsed referrals.
Definition: base.h:457
int fr_ldap_attrs_check(char const **attrs, char const *attr)
Check that a particular attribute is included in an attribute list.
Definition: util.c:579
char const * admin_identity
Identity we bind as when we need to query the LDAP directory.
Definition: base.h:227
global_lib_autoinst_t fr_libldap_global_config
Definition: base.c:134
fr_ldap_result_code_t ret
Result code.
Definition: base.h:465
fr_ldap_result_parser_t parser
Custom results parser.
Definition: base.h:461
fr_ldap_connection_t * fr_ldap_connection_alloc(TALLOC_CTX *ctx)
Allocate our ldap connection handle layer.
Definition: connection.c:253
bool freeit
Whether the control should be freed after we've finished using it.
Definition: base.h:136
fr_rb_tree_t * trunks
Tree of LDAP trunks used by this thread.
Definition: base.h:380
request_t * request
Request this referral relates to.
Definition: base.h:482
int fr_ldap_referral_follow(fr_ldap_thread_t *thread, request_t *request, fr_ldap_query_t *query)
Follow an LDAP referral.
Definition: referral.c:112
fr_trunk_conf_t * trunk_conf
Module trunk config.
Definition: base.h:382
fr_rb_tree_t * queries
Outstanding queries on this connection.
Definition: base.h:349
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.
Definition: bind.c:185
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.
Definition: base.c:449
fr_time_delta_t keepalive_idle
Number of seconds a connections needs to remain idle before TCP starts sending keepalive probes.
Definition: base.h:282
char const * dereference_str
When to dereference (never, searching, finding, always)
Definition: base.h:236
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.
Definition: base.c:998
int fr_ldap_connection_timeout_set(fr_ldap_connection_t const *conn, fr_time_delta_t timeout)
Definition: connection.c:403
fr_connection_t * conn
Connection state handle.
Definition: base.h:343
fr_ldap_directory_t * directory
The type of directory we're connected to.
Definition: base.h:340
fr_ldap_state_t
LDAP connection handle states.
Definition: base.h:166
@ FR_LDAP_STATE_ERROR
Connection is in an error state.
Definition: base.h:171
@ FR_LDAP_STATE_BIND
Connection is being bound.
Definition: base.h:169
@ FR_LDAP_STATE_START_TLS
TLS is being negotiated.
Definition: base.h:168
@ FR_LDAP_STATE_RUN
Connection is muxing/demuxing requests.
Definition: base.h:170
@ FR_LDAP_STATE_INIT
Connection uninitialised.
Definition: base.h:167
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.
Definition: base.c:740
char const * identity
of the user.
Definition: base.h:504
fr_event_timer_t const * ev
Event to close the thread when it has been idle.
Definition: base.h:405
fr_rb_node_t node
Entry in the tree of outstanding queries.
Definition: base.h:421
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.
Definition: base.h:661
fr_dlist_head_t refs
Replied to queries still referencing this connection.
Definition: base.h:350
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...
Definition: util.c:740
size_t fr_ldap_supported_extensions_len
Definition: base.c:64
size_t fr_ldap_connection_states_len
Definition: base.c:58
fr_table_num_sorted_t const fr_ldap_connection_states[]
Definition: base.c:51
int fd
File descriptor for this connection.
Definition: base.h:347
void fr_ldap_state_error(fr_ldap_connection_t *c)
Signal that there's been an error on the connection.
Definition: state.c:134
fr_dlist_t entry
Entry in list of possible referrals.
Definition: base.h:475
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.
Definition: directory.c:253
bool fr_ldap_filter_eval(fr_dlist_head_t *root, fr_ldap_connection_t *conn, LDAPMessage *msg)
Evaluate an LDAP filter.
Definition: filter.c:583
char const * uri
Server URI for this connection.
Definition: base.h:399
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.
Definition: util.c:605
fr_dlist_t entry
Entry in the list of filter nodes.
Definition: base.h:558
const char * sasl_secprops
SASL Security Properties to set.
Definition: base.h:233
struct fr_ldap_referral_s fr_ldap_referral_t
Parsed LDAP referral structure.
Definition: base.h:408
ldap_filter_type_t
Types of parsed LDAP filter nodes.
Definition: base.h:527
@ LDAP_FILTER_GROUP
The filter node is a parent of a group which will be combined using a logical operator.
Definition: base.h:530
@ LDAP_FILTER_NODE
The filter node is an individual one to be evaluated against an attribute.
Definition: base.h:528
void fr_ldap_free(void)
LDAPMessage * result
Previous result.
Definition: base.h:512
fr_time_delta_t keepalive_interval
Interval between keepalive probes.
Definition: base.h:288
fr_time_delta_t tls_handshake_timeout
How long we wait for the TLS handshake to complete.
Definition: base.h:307
int msgid
Of the bind operation. Only used when binding as admin.
Definition: base.h:495
char const * tls_require_cert_str
Sets requirements for validating the certificate the server presents.
Definition: base.h:271
fr_time_delta_t net_timeout
How long we wait in blocking network calls.
Definition: base.h:301
int count
Number of values.
Definition: base.h:361
struct fr_ldap_thread_trunk_s fr_ldap_thread_trunk_t
Thread LDAP trunk structure.
Definition: base.h:325
fr_ldap_config_t const * config
rlm_ldap connection configuration.
Definition: base.h:342
fr_ldap_connection_t * c
to bind. Only used when binding as admin user.
Definition: base.h:502
LDAPControl ** clientctrls
Controls to pass to the client (library).
Definition: base.h:509
#define LDAP_MAX_ATTRMAP
Maximum number of mappings between LDAP and.
Definition: base.h:96
request_t * request
this bind relates to.
Definition: base.h:613
fr_ldap_connection_t * c
to bind. Only used when binding as admin user.
Definition: base.h:489
int fr_ldap_control_add_server(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit)
Add a serverctrl to a connection handle.
Definition: control.c:93
fr_ldap_control_t clientctrls[LDAP_MAX_CONTROLS]
Client controls specific to this query.
Definition: base.h:445
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.
Definition: base.c:786
fr_ldap_bind_type_t
Definition: base.h:516
@ LDAP_BIND_SIMPLE
Definition: base.h:517
int fr_ldap_box_escape(fr_value_box_t *vb, UNUSED void *uctx)
Definition: util.c:110
char const * tls_ca_path
Sets the path to a directory containing CA certificates.
Definition: base.h:263
uint32_t keepalive_probes
Number of missed timeouts before the connection is dropped.
Definition: base.h:285
char const * realm
SASL realm (may be NULL).
Definition: base.h:507
bool rebind
If use_referral_credentials is false, controls whether we bind as our admin credentials (true) or ano...
Definition: base.h:247
static int8_t fr_ldap_query_cmp(void const *one, void const *two)
Compare two ldap query structures on msgid.
Definition: base.h:706
char const * mechs
SASL mechanisms to run.
Definition: base.h:503
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.
Definition: base.c:870
char const * password
of the user, may be NULL if no password is specified.
Definition: base.h:505
static int8_t fr_ldap_trunk_cmp(void const *one, void const *two)
Compare two ldap trunk structures on connection URI / DN.
Definition: base.h:690
fr_ldap_config_t config
Config used for this connection.
Definition: base.h:401
char const * fr_ldap_edir_errstr(int code)
Definition: edir.c:326
int tls_require_cert
OpenLDAP constant representing the require cert string.
Definition: base.h:274
fr_table_num_sorted_t const fr_ldap_tls_require_cert[]
Definition: base.c:77
char const * tls_random_file
Path to the ramdon file if /dev/random and /dev/urandom are unavailable.
Definition: base.h:319
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.
Definition: connection.c:1071
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.
Definition: util.c:699
char * fr_ldap_berval_to_string(TALLOC_CTX *ctx, struct berval const *in)
Convert a berval to a talloced string.
Definition: util.c:390
fr_ldap_state_t fr_ldap_state_next(fr_ldap_connection_t *c)
Move between LDAP connection states.
Definition: state.c:49
fr_table_num_sorted_t const fr_ldap_dereference[]
Definition: base.c:86
char const * identity
Bind identity for referral connection.
Definition: base.h:479
bool start_tls
Send the Start TLS message to the LDAP directory to start encrypted communications using the standard...
Definition: base.h:256
ldap_filter_op_t
Operators for use in LDAP filters.
Definition: base.h:544
@ LDAP_FILTER_OP_BIT_AND
Bitwise AND comparison.
Definition: base.h:551
@ LDAP_FILTER_OP_PRESENT
Attribute present.
Definition: base.h:548
@ LDAP_FILTER_OP_SUBSTR
Attribute matches string with wildcards.
Definition: base.h:547
@ LDAP_FILTER_OP_EQ
Attribute equals value.
Definition: base.h:546
@ LDAP_FILTER_OP_LE
Attribute less than or equal to value.
Definition: base.h:550
@ LDAP_FILTER_OP_BIT_OR
Bitwise OR comparison.
Definition: base.h:552
@ LDAP_FILTER_OP_GE
Attribute greater than or equal to value.
Definition: base.h:549
@ LDAP_FILTER_OP_UNSET
Attribute not set yet.
Definition: base.h:545
int tls_min_version
Definition: base.h:277
bool use_referral_credentials
If true use credentials from the referral URL.
Definition: base.h:243
fr_ldap_query_t * query
Query this referral relates to.
Definition: base.h:476
char const * vendor_str
As returned from the vendorName attribute in the rootDSE.
Definition: base.h:200
fr_ldap_request_type_t
Types of LDAP requests.
Definition: base.h:177
@ LDAP_REQUEST_MODIFY
A modification to an LDAP entity.
Definition: base.h:179
@ LDAP_REQUEST_SEARCH
A lookup in an LDAP directory.
Definition: base.h:178
@ LDAP_REQUEST_EXTENDED
An extended LDAP operation.
Definition: base.h:180
int tls_mode
Definition: base.h:254
int clientctrls_cnt
Number of client controls associated with the handle.
Definition: base.h:338
int fr_ldap_control_add_client(fr_ldap_connection_t *conn, LDAPControl *ctrl, bool freeit)
Add a clientctrl to a connection handle.
Definition: control.c:117
fr_ldap_connection_t * ldap_conn
LDAP connection this query is running on.
Definition: base.h:452
LDAPControl ** serverctrls
Controls to pass to the server.
Definition: base.h:492
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.
Definition: referral.c:49
char const * realm
Kerberos realm.
Definition: base.h:131
char * orig
Text representation of filter for debug messages,.
Definition: base.h:560
fr_ldap_sasl_t admin_sasl
SASL parameters used when binding as the admin.
Definition: base.h:231
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.
Definition: connection.c:1367
fr_trunk_conf_t * bind_trunk_conf
Trunk config for bind auth trunk.
Definition: base.h:383
fr_ldap_result_code_t
LDAP query result codes.
Definition: base.h:186
@ LDAP_RESULT_EXCESS_REFERRALS
The referral chain took too many hops.
Definition: base.h:195
@ LDAP_RESULT_REFERRAL_FAIL
Initial results indicated a referral was needed but the referral could not be followed.
Definition: base.h:193
@ LDAP_RESULT_TIMEOUT
The query timed out.
Definition: base.h:190
@ LDAP_RESULT_ERROR
A general error occurred.
Definition: base.h:189
@ LDAP_RESULT_SUCCESS
Successfully got LDAP results.
Definition: base.h:188
@ LDAP_RESULT_PENDING
Result not yet returned.
Definition: base.h:187
@ LDAP_RESULT_NO_RESULT
No results returned.
Definition: base.h:192
@ LDAP_RESULT_BAD_DN
The requested DN does not exist.
Definition: base.h:191
@ LDAP_RESULT_MISSING_REFERRAL
A referral was indicated but no URL was provided.
Definition: base.h:196
ldap_filter_type_t filter_type
Type of this filter node.
Definition: base.h:559
bool cleartext_password
Whether the server will return the user's plaintext password.
Definition: base.h:206
int msgid
Last msgid. Only used when binding as admin user.
Definition: base.h:511
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.
Definition: base.h:672
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.
Definition: map.c:271
char const * tls_ca_file
Sets the full path to a CA certificate (used to validate the certificate the server presents).
Definition: base.h:260
bool chase_referrals_unset
If true, use the OpenLDAP defaults for chase_referrals.
Definition: base.h:241
#define LDAP_MAP_RESERVED
Number of additional items to allocate in expanded.
Definition: base.h:98
char const ** server_str
Server set in the config.
Definition: base.h:223
#define LDAP_MAX_CONTROLS
Maximum number of client/server controls.
Definition: base.h:94
char const * name
Name of the module that created this connection.
Definition: base.h:220
fr_time_delta_t reconnection_delay
How long to wait before attempting to reconnect.
Definition: base.h:309
uint16_t referral_depth
How many referrals to chase.
Definition: base.h:245
int fr_ldap_directory_result_parse(fr_ldap_directory_t *directory, LDAP *handle, LDAPMessage *result, char const *name)
Definition: directory.c:51
fr_time_delta_t srv_timelimit
How long the server should spent on a single request (also bounded by value on the server).
Definition: base.h:293
int fr_ldap_start_tls_async(fr_ldap_connection_t *c, LDAPControl **serverctrls, LDAPControl **clientctrls)
Install I/O handlers for Start TLS negotiation.
Definition: start_tls.c:222
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.
Definition: base.c:972
void * uctx
User data associated with the handle.
Definition: base.h:352
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.
Definition: util.c:309
fr_ldap_sync_type_t
Definition: base.h:156
@ FR_LDAP_SYNC_NONE
No support for LDAP sync.
Definition: base.h:157
@ FR_LDAP_SYNC_ACTIVE_DIRECTORY
Directory supports AD style persistent search.
Definition: base.h:159
@ FR_LDAP_SYNC_PERSISTENT_SEARCH
Directory supports persistent search.
Definition: base.h:160
@ FR_LDAP_SYNC_RFC4533
Directory supports RFC 4533.
Definition: base.h:158
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.
Definition: base.c:827
LDAPMessage * result
Head of LDAP results list.
Definition: base.h:463
fr_event_list_t * el
Thread event list for callbacks / timeouts.
Definition: base.h:384
fr_ldap_directory_t * directory
The type of directory we're connected to.
Definition: base.h:402
LDAPControl * control
LDAP control.
Definition: base.h:135
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.
Definition: map.c:323
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.
Definition: edir.c:295
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.
Definition: base.c:694
char const * rmech
Mech we're continuing with.
Definition: base.h:513
char const * password
Bind password for referral connection.
Definition: base.h:480
char const * tls_min_version_str
Minimum TLS version.
Definition: base.h:276
LDAPControl ** serverctrls
Controls to pass to the server.
Definition: base.h:508
uint16_t port
Port to use when binding to the server.
Definition: base.h:225
fr_trunk_t * trunk
Connection trunk.
Definition: base.h:403
fr_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.
Definition: connection.c:380
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.
Definition: base.c:152
fr_ldap_thread_trunk_t * bind_trunk
LDAP trunk used for bind auths.
Definition: base.h:385
int fr_ldap_connection_timeout_reset(fr_ldap_connection_t const *conn)
Definition: connection.c:425
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.
Definition: bind.c:319
char const * version_str
As returned from the vendorVersion attribute in the rootDSE.
Definition: base.h:202
char const * bind_dn
of the user, may be NULL to bind anonymously.
Definition: base.h:490
void(* fr_ldap_result_parser_t)(LDAP *handle, fr_ldap_query_t *query, LDAPMessage *head, void *rctx)
Definition: base.h:412
fr_ldap_thread_t * thread
This bind is being run by.
Definition: base.h:610
fr_ldap_thread_trunk_t * ttrunk
Trunk this referral should use.
Definition: base.h:481
fr_ldap_referral_t * referral
Referral actually being followed.
Definition: base.h:459
size_t fr_ldap_tls_require_cert_len
Definition: base.c:84
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.
Definition: base.c:1021
fr_table_num_sorted_t const fr_ldap_scope[]
Definition: base.c:69
TALLOC_CTX * ctx
Context to allocate new attributes in.
Definition: base.h:372
fr_rb_tree_t * binds
Tree of outstanding bind auths.
Definition: base.h:386
fr_trunk_request_t * treq
Trunk request this bind is associated with.
Definition: base.h:611
int fr_ldap_connection_configure(fr_ldap_connection_t *c, fr_ldap_config_t const *config)
Allocate and configure a new connection.
Definition: connection.c:67
uint32_t ldap_debug
LDAP debug level.
Definition: base.h:318
int(* filter_attr_check_t)(char const *attr, void *uctx)
Definition: base.h:962
fr_rb_node_t node
Entry in the tree of outstanding bind requests.
Definition: base.h:609
fr_ldap_bind_type_t type
type of bind.
Definition: base.h:614
char const ** naming_contexts
Databases served by this directory.
Definition: base.h:211
int fr_ldap_referral_next(fr_ldap_thread_t *thread, request_t *request, fr_ldap_query_t *query)
Follow an alternative LDAP referral.
Definition: referral.c:309
char const * password
of the user, may be NULL if no password is specified.
Definition: base.h:491
ldap_supported_extension_t
Definition: base.h:122
@ LDAP_EXT_BINDPW
Specifies the password for an LDAP bind.
Definition: base.h:125
@ LDAP_EXT_UNSUPPORTED
Unsupported extension.
Definition: base.h:123
@ LDAP_EXT_BINDNAME
Specifies the user DN or name for an LDAP bind.
Definition: base.h:124
fr_time_delta_t idle_timeout
How long to wait before closing unused connections.
Definition: base.h:311
fr_ldap_directory_type_t type
Canonical server implementation.
Definition: base.h:204
fr_ldap_request_type_t type
What type of query this is.
Definition: base.h:442
int fr_ldap_init(void)
Initialise libldap and check library versions.
Definition: base.c:1110
fr_ldap_rcode_t
Codes returned by fr_ldap internal functions.
Definition: base.h:577
@ LDAP_PROC_CONTINUE
Operation is in progress.
Definition: base.h:579
@ LDAP_PROC_SUCCESS
Operation was successful.
Definition: base.h:580
@ LDAP_PROC_REFERRAL
LDAP server returned referral URLs.
Definition: base.h:578
@ LDAP_PROC_TIMEOUT
Operation timed out.
Definition: base.h:597
@ LDAP_PROC_ERROR
Unrecoverable library/server error.
Definition: base.h:582
@ LDAP_PROC_BAD_CONN
Transitory error, caller should retry the operation with a new connection.
Definition: base.h:584
@ LDAP_PROC_NOT_PERMITTED
Operation was not permitted, either current user was locked out in the case of binds,...
Definition: base.h:587
@ LDAP_PROC_REJECT
Bind failed, user was rejected.
Definition: base.h:591
@ LDAP_PROC_REFRESH_REQUIRED
Don't continue with the current refresh phase, exit, and retry the operation with a NULL cookie.
Definition: base.h:599
@ LDAP_PROC_BAD_DN
Specified an invalid object in a bind or search DN.
Definition: base.h:593
@ LDAP_PROC_NO_RESULT
Got no results.
Definition: base.h:595
LDAPURLDesc * ldap_url
parsed URL for current query if the source of the query was a URL.
Definition: base.h:424
Holds arguments for async bind auth requests.
Definition: base.h:608
Holds arguments for the async bind operation.
Definition: base.h:488
Connection configuration.
Definition: base.h:219
Tracks the state of a libldap connection handle.
Definition: base.h:330
Result of expanding the RHS of a set of maps.
Definition: base.h:368
LDAP query structure.
Definition: base.h:420
Parsed LDAP referral structure.
Definition: base.h:474
Contains a collection of values.
Definition: base.h:358
Holds arguments for the async SASL bind operation.
Definition: base.h:501
Thread specific structure to manage LDAP trunk connections.
Definition: base.h:379
Thread LDAP trunk structure.
Definition: base.h:397
libldap global configuration data
Definition: base.h:317
Structure to hold parsed details of LDAP filters.
Definition: base.h:557
Stores all information relating to an event list.
Definition: event.c:411
A timer event.
Definition: event.c:102
unsigned short uint16_t
Definition: merged_model.c:31
unsigned int uint32_t
Definition: merged_model.c:33
unsigned char uint8_t
Definition: merged_model.c:30
ssize_t fr_slen_t
Definition: merged_model.c:35
static const conf_parser_t config[]
Definition: base.c:188
The main red black tree structure.
Definition: rb.h:73
static char const * name
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.
Definition: sasl.c:504
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.
Definition: sasl.c:308
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.
Definition: sasl.c:367
Optional arguments passed to vp_tmpl functions.
Definition: tmpl.h:341
Value pair map.
Definition: map.h:77
An element in a lexicographically sorted array of name to num mappings.
Definition: table.h:45
A time delta, a difference in time measured in nanoseconds.
Definition: time.h:80
Wraps a normal request.
Definition: trunk.c:97
Main trunk management handle.
Definition: trunk.c:189
fr_trunk_state_t
Definition: trunk.h:62
Common configuration parameters for a trunk.
Definition: trunk.h:213
static fr_event_list_t * el
static fr_slen_t head
Definition: xlat.h:408
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.
Definition: value.c:4497
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.
Definition: value.c:4181
static size_t char fr_sbuff_t size_t inlen
Definition: value.h:984
int nonnull(2, 5))
static size_t char ** out
Definition: value.h:984