ldap-client.h revision d3be0145dff35c54c3c89c3ad3e1afd2c486a2d4
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi/* Called when the LDAP result has finished. The callback must verify first
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi if the result is valid or not by calling ldap_result_has_failed() or
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi ldap_result_get_error(). The result is freed automatically after this
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi callback finishes. */
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomitypedef void ldap_result_callback_t(struct ldap_result *result, void *context);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *uri;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *bind_dn;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi unsigned int debug;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *base_dn;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *filter;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *const *attributes;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi unsigned int size_limit;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *dn;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *attr;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi const char *value;
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi/* Initialize LDAP. Returns 0 on success, or -1 and error_r if initialization
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi failed with the given settings. */
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiint ldap_client_init(const struct ldap_client_settings *set,
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi struct ldap_client **client_r, const char **error_r);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomivoid ldap_client_deinit(struct ldap_client **client);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomivoid ldap_client_switch_ioloop(struct ldap_client *client);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi#define ldap_search_start(client, input, callback, context) \
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi/* Returns TRUE if the LDAP query failed and result must not be used further. */
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomibool ldap_result_has_failed(struct ldap_result *result);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi/* Returns the error string if the query had failed, or NULL if it hasn't. */
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiconst char *ldap_result_get_error(struct ldap_result *result);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomistruct ldap_search_iterator* ldap_search_iterator_init(struct ldap_result *result);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiconst struct ldap_entry *ldap_search_iterator_next(struct ldap_search_iterator *iter);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomivoid ldap_search_iterator_deinit(struct ldap_search_iterator **iter);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomivoid ldap_compare_start(struct ldap_client *client,
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi#define ldap_compare_start(client, input, callback, context) \
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomi/* Returns TRUE if the comparison matched, FALSE if not. */
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomibool ldap_compare_result(struct ldap_result *result);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiconst char *ldap_entry_dn(const struct ldap_entry *entry);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiconst char *const *ldap_entry_get_attributes(const struct ldap_entry *entry);
844129da33797fba15314372a0dfab4cfe8162e8Aki Tuomiconst char *const *ldap_entry_get_attribute(const struct ldap_entry *entry, const char *attribute);