From: Marco Bettini Date: Tue, 4 Oct 2022 15:37:58 +0000 (+0000) Subject: lib-dict-backend: Replace i_() with e_() X-Git-Tag: 2.4.0~3522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a9964c59b12c3f953194afa1b90bdf196255fe4;p=thirdparty%2Fdovecot%2Fcore.git lib-dict-backend: Replace i_() with e_() --- diff --git a/src/lib-dict-backend/dict-ldap.c b/src/lib-dict-backend/dict-ldap.c index 2142184cc9..d9f35b0f13 100644 --- a/src/lib-dict-backend/dict-ldap.c +++ b/src/lib-dict-backend/dict-ldap.c @@ -23,6 +23,7 @@ struct ldap_dict; struct dict_ldap_op { struct ldap_dict *dict; + struct event *event; const struct dict_ldap_map *map; pool_t pool; unsigned long txid; @@ -327,23 +328,25 @@ ldap_dict_lookup_callback(struct ldap_result *result, struct dict_ldap_op *op) 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; } } @@ -356,6 +359,8 @@ ldap_dict_lookup_callback(struct ldap_result *result, struct dict_ldap_op *op) io_loop_set_current(op->dict->dict.ioloop); io_loop_stop(op->dict->dict.ioloop); } + + event_unref(&op->event); pool_unref(&pool); } @@ -442,6 +447,9 @@ void ldap_dict_lookup_async(struct dict *dict, 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}; @@ -458,6 +466,7 @@ void ldap_dict_lookup_async(struct dict *dict, 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; } @@ -469,6 +478,7 @@ void ldap_dict_lookup_async(struct dict *dict, } else { op->res.error = "no such key"; callback(&op->res, context); + event_unref(&op->event); pool_unref(&oppool); } } diff --git a/src/lib-dict-backend/dict-sql.c b/src/lib-dict-backend/dict-sql.c index d030a9a543..f520a76d43 100644 --- a/src/lib-dict-backend/dict-sql.c +++ b/src/lib-dict-backend/dict-sql.c @@ -1005,7 +1005,7 @@ sql_dict_transaction_commit_callback(const struct sql_commit_result *sql_result, if (ctx->async_callback != NULL) ctx->async_callback(&result, ctx->async_context); else if (result.ret < 0) - i_error("%s", result.error); + e_error(ctx->ctx.event, "%s", result.error); sql_dict_transaction_free(ctx); }