The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Functions | Variables
proto_ldap_sync.c File Reference

LDAP sync protocol handler. More...

#include <freeradius-devel/internal/internal.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/server/module.h>
#include "proto_ldap_sync.h"
#include <fcntl.h>
+ Include dependency graph for proto_ldap_sync.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX   "proto_ldap_sync"
 

Functions

int ldap_sync_conf_attr_add (sync_config_t *config, char const *attr)
 Check if an attribute is in the config list and add if not present. More...
 
static int mod_bootstrap (module_inst_ctx_t const *mctx)
 
static int mod_decode (UNUSED void const *instance, request_t *request, uint8_t *const data, size_t data_len)
 Decode an internal LDAP sync packet. More...
 
static ssize_t mod_encode (UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
 Encode responses to processing LDAP sync sections. More...
 
static int mod_instantiate (module_inst_ctx_t const *mctx)
 
static int mod_open (void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf)
 
static int transport_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)
 
static int transport_parse (TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, UNUSED conf_parser_t const *rule)
 Wrapper around dl_instance. More...
 

Variables

static fr_dict_attr_t const * attr_ldap_sync
 
static fr_dict_attr_t const * attr_ldap_sync_cookie
 
static fr_dict_attr_t const * attr_ldap_sync_dn
 
static fr_dict_attr_t const * attr_ldap_sync_filter
 
static fr_dict_attr_t const * attr_ldap_sync_packet_id
 
static fr_dict_attr_t const * attr_ldap_sync_scope
 
static fr_dict_attr_t const * attr_packet_type
 
static fr_dict_t const * dict_ldap_sync
 
static fr_internal_encode_ctx_t encode_ctx = { .allow_name_only = true }
 
static conf_parser_t const ldap_sync_search_config []
 
fr_app_t proto_ldap_sync
 
static conf_parser_t const proto_ldap_sync_config []
 
fr_dict_autoload_t proto_ldap_sync_dict []
 
fr_dict_attr_autoload_t proto_ldap_sync_dict_attr []
 

Detailed Description

LDAP sync protocol handler.

Id
809c26d3763dfe3663acef7a8349accc4b1cb7c8

Definition in file proto_ldap_sync.c.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "proto_ldap_sync"

Definition at line 24 of file proto_ldap_sync.c.

Function Documentation

◆ ldap_sync_conf_attr_add()

int ldap_sync_conf_attr_add ( sync_config_t config,
char const *  attr 
)

Check if an attribute is in the config list and add if not present.

Parameters
[in,out]configto check for attribute.
[in]attrto look for.
Returns
  • 1 if attr is added
  • 0 if attr was already present

Definition at line 147 of file proto_ldap_sync.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mod_bootstrap()

static int mod_bootstrap ( module_inst_ctx_t const *  mctx)
static

Definition at line 411 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

◆ mod_decode()

static int mod_decode ( UNUSED void const *  instance,
request_t request,
uint8_t *const  data,
size_t  data_len 
)
static

Decode an internal LDAP sync packet.

Definition at line 166 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

◆ mod_encode()

static ssize_t mod_encode ( UNUSED void const *  instance,
request_t request,
uint8_t buffer,
size_t  buffer_len 
)
static

Encode responses to processing LDAP sync sections.

Definition at line 198 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

◆ mod_instantiate()

static int mod_instantiate ( module_inst_ctx_t const *  mctx)
static

Definition at line 277 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

◆ mod_open()

static int mod_open ( void *  instance,
fr_schedule_t sc,
UNUSED CONF_SECTION conf 
)
static

Definition at line 238 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

◆ transport_parse() [1/2]

static int transport_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
conf_parser_t const *  rule 
)
static

◆ transport_parse() [2/2]

static int transport_parse ( TALLOC_CTX *  ctx,
void *  out,
UNUSED void *  parent,
CONF_ITEM ci,
UNUSED conf_parser_t const *  rule 
)
static

Wrapper around dl_instance.

Parameters
[in]ctxto allocate data in (instance of proto_dns).
[out]outWhere to write a dl_module_inst_t containing the module handle and instance.
[in]parentBase structure address.
[in]ciCONF_PAIR specifying the name of the type module.
[in]ruleunused.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 109 of file proto_ldap_sync.c.

+ Here is the call graph for this function:

Variable Documentation

◆ attr_ldap_sync

fr_dict_attr_t const* attr_ldap_sync
static

Definition at line 79 of file proto_ldap_sync.c.

◆ attr_ldap_sync_cookie

fr_dict_attr_t const* attr_ldap_sync_cookie
static

Definition at line 80 of file proto_ldap_sync.c.

◆ attr_ldap_sync_dn

fr_dict_attr_t const* attr_ldap_sync_dn
static

Definition at line 81 of file proto_ldap_sync.c.

◆ attr_ldap_sync_filter

fr_dict_attr_t const* attr_ldap_sync_filter
static

Definition at line 83 of file proto_ldap_sync.c.

◆ attr_ldap_sync_packet_id

fr_dict_attr_t const* attr_ldap_sync_packet_id
static

Definition at line 78 of file proto_ldap_sync.c.

◆ attr_ldap_sync_scope

fr_dict_attr_t const* attr_ldap_sync_scope
static

Definition at line 82 of file proto_ldap_sync.c.

◆ attr_packet_type

fr_dict_attr_t const* attr_packet_type
static

Definition at line 84 of file proto_ldap_sync.c.

◆ dict_ldap_sync

fr_dict_t const* dict_ldap_sync
static

Definition at line 70 of file proto_ldap_sync.c.

◆ encode_ctx

fr_internal_encode_ctx_t encode_ctx = { .allow_name_only = true }
static

Definition at line 34 of file proto_ldap_sync.c.

◆ ldap_sync_search_config

conf_parser_t const ldap_sync_search_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET("base_dn", sync_config_t, base_dn), .dflt = "", .quote = T_SINGLE_QUOTED_STRING },
{ FR_CONF_OFFSET("filter", sync_config_t, filter) },
{ FR_CONF_OFFSET("scope", sync_config_t, scope_str), .dflt = "sub" },
{ FR_CONF_OFFSET("changes_only", sync_config_t, changes_only), .dflt = "yes" },
}
#define CONF_PARSER_TERMINATOR
Definition: cf_parse.h:626
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
Areas of the directory to receive notifications for.
@ T_SINGLE_QUOTED_STRING
Definition: token.h:122

Definition at line 40 of file proto_ldap_sync.c.

◆ proto_ldap_sync

fr_app_t proto_ldap_sync
Initial value:
= {
.common = {
.name = "ldap_sync",
.inst_size = sizeof(proto_ldap_sync_t),
.bootstrap = mod_bootstrap,
},
.dict = &dict_ldap_sync,
.open = mod_open,
.decode = mod_decode,
.encode = mod_encode,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
Definition: dl_module.h:65
static ssize_t mod_encode(UNUSED void const *instance, request_t *request, uint8_t *buffer, size_t buffer_len)
Encode responses to processing LDAP sync sections.
static fr_dict_t const * dict_ldap_sync
static conf_parser_t const proto_ldap_sync_config[]
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static int mod_decode(UNUSED void const *instance, request_t *request, uint8_t *const data, size_t data_len)
Decode an internal LDAP sync packet.
static int mod_instantiate(module_inst_ctx_t const *mctx)
static int mod_open(void *instance, fr_schedule_t *sc, UNUSED CONF_SECTION *conf)
An instance of a proto_ldap_sync listen section.
static int instantiate(module_inst_ctx_t const *mctx)
Definition: rlm_rest.c:1312

Definition at line 441 of file proto_ldap_sync.c.

◆ proto_ldap_sync_config

conf_parser_t const proto_ldap_sync_config[]
static
Initial value:
= {
{ FR_CONF_OFFSET_TYPE_FLAGS("transport", FR_TYPE_VOID, 0, proto_ldap_sync_t, io_submodule),
.func = transport_parse },
{ FR_CONF_OFFSET("max_packet_size", proto_ldap_sync_t, max_packet_size) },
{ FR_CONF_OFFSET("num_messages", proto_ldap_sync_t, num_messages) },
{ FR_CONF_OFFSET("cookie_interval", proto_ldap_sync_t, cookie_interval), .dflt = "10" },
{ FR_CONF_OFFSET("cookie_changes", proto_ldap_sync_t, cookie_changes), .dflt = "100" },
{ FR_CONF_OFFSET("retry_interval", proto_ldap_sync_t, retry_interval), .dflt = "1" },
}
#define FR_CONF_SUBSECTION_ALLOC(_name, _type, _flags, _struct, _field, _subcs)
A conf_parser_t multi-subsection.
Definition: cf_parse.h:345
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
Definition: cf_parse.h:406
@ CONF_FLAG_MULTI
CONF_PAIR can have multiple copies.
Definition: cf_parse.h:420
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
Definition: cf_parse.h:400
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:241
@ FR_TYPE_VOID
User data.
Definition: merged_model.c:127
static conf_parser_t const ldap_sync_search_config[]
static int transport_parse(TALLOC_CTX *ctx, void *out, UNUSED void *parent, CONF_ITEM *ci, conf_parser_t const *rule)

Definition at line 52 of file proto_ldap_sync.c.

◆ proto_ldap_sync_dict

fr_dict_autoload_t proto_ldap_sync_dict
Initial value:
= {
{ .out = &dict_ldap_sync, .proto = "ldap" },
{ NULL }
}

Definition at line 73 of file proto_ldap_sync.c.

◆ proto_ldap_sync_dict_attr

fr_dict_attr_autoload_t proto_ldap_sync_dict_attr
Initial value:
= {
{ .out = &attr_ldap_sync_packet_id, .name = "Sync-Packet-ID", .type = FR_TYPE_UINT32, .dict = &dict_ldap_sync },
{ .out = &attr_ldap_sync, .name = "LDAP-Sync", .type = FR_TYPE_TLV, .dict = &dict_ldap_sync },
{ .out = &attr_ldap_sync_cookie, .name = "LDAP-Sync.Cookie", .type = FR_TYPE_OCTETS, .dict = &dict_ldap_sync },
{ .out = &attr_ldap_sync_dn, .name = "LDAP-Sync.DN", .type = FR_TYPE_STRING, .dict = &dict_ldap_sync },
{ .out = &attr_ldap_sync_scope, .name = "LDAP-Sync.Scope", .type = FR_TYPE_UINT32, .dict = &dict_ldap_sync },
{ .out = &attr_ldap_sync_filter, .name = "LDAP-Sync.Filter", .type = FR_TYPE_STRING, .dict = &dict_ldap_sync },
{ .out = &attr_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_ldap_sync },
{ NULL }
}
@ FR_TYPE_TLV
Contains nested attributes.
Definition: merged_model.c:118
@ FR_TYPE_STRING
String of printable characters.
Definition: merged_model.c:83
@ FR_TYPE_UINT32
32 Bit unsigned integer.
Definition: merged_model.c:99
@ FR_TYPE_OCTETS
Raw octets.
Definition: merged_model.c:84
static fr_dict_attr_t const * attr_ldap_sync_filter
static fr_dict_attr_t const * attr_packet_type
static fr_dict_attr_t const * attr_ldap_sync_packet_id
static fr_dict_attr_t const * attr_ldap_sync_dn
static fr_dict_attr_t const * attr_ldap_sync
static fr_dict_attr_t const * attr_ldap_sync_scope
static fr_dict_attr_t const * attr_ldap_sync_cookie

Definition at line 87 of file proto_ldap_sync.c.