struct dict_ldap_op {
struct ldap_dict *dict;
+ struct event *event;
const struct dict_ldap_map *map;
pool_t pool;
unsigned long txid;
iter = ldap_search_iterator_init(result);
entry = ldap_search_iterator_next(iter);
if (entry != NULL) {
- if (op->dict->set->debug > 0)
- i_debug("ldap_dict_lookup_callback got dn %s", ldap_entry_dn(entry));
+ e_debug(op->event, "ldap_dict_lookup_callback got dn %s",
+ ldap_entry_dn(entry));
/* try extract value */
const char *const *values = ldap_entry_get_attribute(entry, op->map->value_attribute);
if (values != NULL) {
const char **new_values;
- if (op->dict->set->debug > 0)
- i_debug("ldap_dict_lookup_callback got attribute %s", op->map->value_attribute);
+ e_debug(op->event,
+ "ldap_dict_lookup_callback got attribute %s",
+ op->map->value_attribute);
op->res.ret = 1;
new_values = p_new(op->pool, const char *, 2);
new_values[0] = p_strdup(op->pool, values[0]);
op->res.values = new_values;
op->res.value = op->res.values[0];
} else {
- if (op->dict->set->debug > 0)
- i_debug("ldap_dict_lookup_callback dit not get attribute %s", op->map->value_attribute);
+ e_debug(op->event,
+ "ldap_dict_lookup_callback dit not get attribute %s",
+ op->map->value_attribute);
op->res.value = NULL;
}
}
io_loop_set_current(op->dict->dict.ioloop);
io_loop_stop(op->dict->dict.ioloop);
}
+
+ event_unref(&op->event);
pool_unref(&pool);
}
op->callback_ctx = context;
op->txid = ctx->last_txid++;
+ op->event = event_create(op->dict->dict.event);
+ event_set_forced_debug(op->event, op->dict->set->debug > 0);
+
/* key needs to be transformed into something else */
ARRAY_TYPE(const_string) values;
const char *attributes[2] = {0, 0};
if (!ldap_dict_build_query(set, map, &values, strncmp(key, DICT_PATH_PRIVATE, strlen(DICT_PATH_PRIVATE))==0, query, &error)) {
op->res.error = error;
callback(&op->res, context);
+ event_unref(&op->event);
pool_unref(&oppool);
return;
}
} else {
op->res.error = "no such key";
callback(&op->res, context);
+ event_unref(&op->event);
pool_unref(&oppool);
}
}