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);
9e6c76cae59ece71f72e33d8fac9025ee12eaf05Timo Sirainen /* NOTE: when adding here, remember to update
9e6c76cae59ece71f72e33d8fac9025ee12eaf05Timo Sirainen ldap_connection_have_settings() and ldap_connection_init() */
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);
9e6c76cae59ece71f72e33d8fac9025ee12eaf05Timo Sirainen/* Deinitialize all pooled LDAP connections if there are no references left.
9e6c76cae59ece71f72e33d8fac9025ee12eaf05Timo Sirainen This allows freeing the memory at deinit, but still allows multiple
9e6c76cae59ece71f72e33d8fac9025ee12eaf05Timo Sirainen independent code parts to use lib-ldap and call this function. */
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);