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

LDAP sync callback functions for servers implementing persistent search. More...

#include "persistent_search.h"
#include "proto_ldap_sync_ldap.h"
#include <freeradius-devel/ldap/base.h>
#include <freeradius-devel/util/debug.h>
+ Include dependency graph for persistent_search.c:

Go to the source code of this file.

Macros

#define LOG_PREFIX   "ldap_sync_persistent"
 

Functions

int persistent_sync_search_entry (sync_state_t *sync, LDAPMessage *msg, LDAPControl **ctrls)
 Handle a SearchResultEntry response from Persistent Search LDAP servers. More...
 
int persistent_sync_state_init (fr_ldap_connection_t *conn, size_t sync_no, proto_ldap_sync_t const *inst, UNUSED uint8_t const *cookie)
 Allocate and initialise sync queries for persistent searches. More...
 

Detailed Description

LDAP sync callback functions for servers implementing persistent search.

Id
314b29c12381543e4d43a48a035240c02b54c5f7

Definition in file persistent_search.c.

Macro Definition Documentation

◆ LOG_PREFIX

#define LOG_PREFIX   "ldap_sync_persistent"

Definition at line 25 of file persistent_search.c.

Function Documentation

◆ persistent_sync_search_entry()

int persistent_sync_search_entry ( sync_state_t sync,
LDAPMessage *  msg,
LDAPControl **  ctrls 
)

Handle a SearchResultEntry response from Persistent Search LDAP servers.

Upon receipt of a search request containing the PersistentSearch control, if changesOnly is false, the server provides the initial content using zero or more SearchResultEntries without EntryChangeNotification controls.

Changes subsequent to the initial search request, result in SearchResultEntry or SearchResultReference with the EntryChangeNotification control which indicates what type of change is being reported.

The Entry Change Notification is an LDAP Control where the controlType is the object identifier 2.16.840.1.113730.3.4.3 and the controlValue, an OCTET STRING. It contains a BER-encoded syncStateValue.

EntryChangeNotification ::= SEQUENCE { changeType ENUMERATED { add (1), delete (2) modify (4), modDN (8) }, previousDN LDAPDN OPTIONAL, – only when the changeType is modDN changeNumber INTEGER OPTIONAL – if supported, the changeNumber from the change log. }

The Sync State Control is only included in SearchResultEntry and SearchResultReference Messages.

Parameters
[in]syncmessage was associated with.
[in]msgcontaining an entry to process.
[in]ctrlsassociated with the msg.
Returns
  • 0 on success.
  • -1 on failure.

Definition at line 178 of file persistent_search.c.

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

◆ persistent_sync_state_init()

int persistent_sync_state_init ( fr_ldap_connection_t conn,
size_t  sync_no,
proto_ldap_sync_t const *  inst,
UNUSED uint8_t const *  cookie 
)

Allocate and initialise sync queries for persistent searches.

Servers implementing https://tools.ietf.org/id/draft-ietf-ldapext-psearch-03.txt

The persisntent search control is defined as

PersistentSearch ::= SEQUENCE { changeTypes INTEGER, changesOnly BOOLEAN returnECs BOOLEAN }

The sync structure is parented off the conn. When the sync is no longer needed, or an error has occurred, it should be freed with talloc_free(), which will result in an ldap_abandon message to the server to tell it to cancel the search.

Parameters
[in]connConnection to issue the search request on.
[in]sync_nonumber of the sync in the array of configs.
[in]instinstance of ldap_sync this query relates to.
[in]cookienot applicable to persistent search LDAP servers.

Definition at line 53 of file persistent_search.c.

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