From b103d44fc1d9f163a3ac7549fd9834ecbe3f1c8f Mon Sep 17 00:00:00 2001 From: Sergey Kitov Date: Tue, 20 Mar 2018 09:05:26 +0200 Subject: [PATCH] global: Replace check for auth_debug with event_want_debug_log in doveadm-auth::auth_connected() These functions will create event with "auth" category and unref it in the end. --- src/doveadm/doveadm-auth.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/doveadm/doveadm-auth.c b/src/doveadm/doveadm-auth.c index d5a5edafa7..1da664fd8f 100644 --- a/src/doveadm/doveadm-auth.c +++ b/src/doveadm/doveadm-auth.c @@ -25,6 +25,10 @@ #include #include +static struct event_category event_category_auth = { + .name = "auth", +}; + struct authtest_input { pool_t pool; const char *username; @@ -159,12 +163,15 @@ auth_callback(struct auth_client_request *request ATTR_UNUSED, static void auth_connected(struct auth_client *client, bool connected, void *context) { + struct event *event_auth; struct authtest_input *input = context; struct auth_request_info info; string_t *init_resp, *base64_resp; if (!connected) i_fatal("Couldn't connect to auth socket"); + event_auth = event_create(NULL); + event_add_category(event_auth, &event_category_auth); init_resp = t_str_new(128); str_append(init_resp, input->username); @@ -187,11 +194,13 @@ static void auth_connected(struct auth_client *client, info.remote_ip = input->info.remote_ip; info.remote_port = input->info.remote_port; info.initial_resp_base64 = str_c(base64_resp); - if (doveadm_settings->auth_debug) + if (doveadm_settings->auth_debug || + event_want_debug_log(event_auth)) info.flags |= AUTH_REQUEST_FLAG_DEBUG; input->request = auth_client_request_new(client, &info, auth_callback, input); + event_unref(&event_auth); } static void