The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Data Structures | Functions
sync_touch.c File Reference

Test utility that touches entries, so LDAP sync clients re-process them. More...

#include <freeradius-devel/autoconf.h>
#include <ldap.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ Include dependency graph for sync_touch.c:

Go to the source code of this file.

Data Structures

struct  sync_touch_conf_t
 

Functions

int main (int argc, char **argv)
 
static char * password_from_file (char const *path)
 Read the bind password from the first line of a file.
 
static int touch_entry (LDAP *ld, sync_touch_conf_t const *conf, LDAPMessage *entry)
 Touch one entry by replacing an attribute with the current values of the attribute.
 
static NEVER_RETURNS void usage (int status)
 

Detailed Description

Test utility that touches entries, so LDAP sync clients re-process them.

Replaces an attribute with its current values, which OpenLDAP records as a modification (other servers may not), and skips entries without the attribute.

Author
Arran Cudbard-Bell

Definition in file sync_touch.c.


Data Structure Documentation

◆ sync_touch_conf_t

struct sync_touch_conf_t

Definition at line 46 of file sync_touch.c.

Data Fields
char const * attr Attribute to replace with the current values of the attribute.
char const * base_dn Where to start the search.
char const * bind_dn Distinguished Name (DN) to bind as. NULL for an anonymous bind.
char const * bind_pw Password to bind with.
bool dry_run Print the entries that sync_touch would touch, without modifying the entries.
char const * filter Search filter that selects the entries to touch.
int scope LDAP_SCOPE_* value for the search.
bool start_tls Whether to use the StartTLS extended operation.
char const * uri LDAP server to connect to.
int verbose 1 prints each entry. 2 or more also prints libldap debug output.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 174 of file sync_touch.c.

+ Here is the call graph for this function:

◆ password_from_file()

static char * password_from_file ( char const *  path)
static

Read the bind password from the first line of a file.

Parameters
[in]pathof the file.
Returns
the password, or NULL on error. The caller must free() the password.

Definition at line 86 of file sync_touch.c.

+ Here is the caller graph for this function:

◆ touch_entry()

static int touch_entry ( LDAP *  ld,
sync_touch_conf_t const *  conf,
LDAPMessage *  entry 
)
static

Touch one entry by replacing an attribute with the current values of the attribute.

Parameters
[in]ldconnection to the directory.
[in]confsearch and touch options.
[in]entryfrom the search.
Returns
  • 1 if the entry was touched.
  • 0 if the entry was skipped, because the entry does not have the attribute.
  • -1 on error.

Definition at line 123 of file sync_touch.c.

+ Here is the caller graph for this function:

◆ usage()

static NEVER_RETURNS void usage ( int  status)
static

Definition at line 59 of file sync_touch.c.