ldap-client.h revision 3b840237852271bfb8e6f4258c3656edc72e9a79
#ifndef LDAP_CLIENT_H
#define LDAP_CLIENT_H
enum ldap_scope {
LDAP_SEARCH_SCOPE_BASE = 0x0000,
LDAP_SEARCH_SCOPE_ONE = 0x0001,
LDAP_SEARCH_SCOPE_SUBTREE = 0x0002
};
struct ldap_client;
struct ldap_result;
struct ldap_search_iterator;
struct ldap_entry;
/* Called when the LDAP result has finished. The callback must verify first
if the result is valid or not by calling ldap_result_has_failed() or
ldap_result_get_error(). The result is freed automatically after this
callback finishes. */
struct ldap_client_settings {
const char *uri;
const char *bind_dn;
const char *password;
const struct ssl_iostream_settings *ssl_set;
unsigned int timeout_secs;
unsigned int max_idle_time_secs;
unsigned int debug;
};
struct ldap_search_input {
const char *base_dn;
const char *filter;
const char *const *attributes;
enum ldap_scope scope;
unsigned int size_limit;
unsigned int timeout_secs;
};
struct ldap_compare_input {
const char *dn;
const char *attr;
const char *value;
unsigned int timeout_secs;
};
/* Initialize LDAP. Returns 0 on success, or -1 and error_r if initialization
failed with the given settings. */
const struct ldap_search_input *input,
void *context);
CALLBACK_TYPECHECK(callback, void (*)( \
/* Returns TRUE if the LDAP query failed and result must not be used further. */
/* Returns the error string if the query had failed, or NULL if it hasn't. */
const struct ldap_compare_input *input,
CALLBACK_TYPECHECK(callback, void (*)( \
/* Returns TRUE if the comparison matched, FALSE if not. */
#endif