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>
Go to the source code of this file.
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
- Copyright
- 2017 Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
Definition in file sync_touch.c.
◆ 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. |
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
◆ password_from_file()
| static char * password_from_file |
( |
char const * |
path | ) |
|
|
static |
Read the bind password from the first line of a file.
- Parameters
-
- Returns
- the password, or NULL on error. The caller must free() the password.
Definition at line 86 of file sync_touch.c.
◆ 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] | ld | connection to the directory. |
| [in] | conf | search and touch options. |
| [in] | entry | from 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.
◆ usage()