From: Karl Fleischmann Date: Tue, 15 Mar 2022 13:49:58 +0000 (+0100) Subject: auth: Remove extraneous debug check when calling e_debug() X-Git-Tag: 2.4.0~4168 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8ed4106b5484710783d7f58067b03b31db48dc9;p=thirdparty%2Fdovecot%2Fcore.git auth: Remove extraneous debug check when calling e_debug() Remove checks for debug setting when calling e_debug() as it is already doing the necessary check. --- diff --git a/src/auth/auth-client-connection.c b/src/auth/auth-client-connection.c index 902967d2a8..9c1a7b604f 100644 --- a/src/auth/auth-client-connection.c +++ b/src/auth/auth-client-connection.c @@ -215,24 +215,19 @@ auth_client_handle_line(struct auth_client_connection *conn, const char *line) const char *args; if (str_begins(line, "AUTH\t", &args)) { - if (conn->auth->set->debug) { - e_debug(conn->event, "client in: %s", - auth_line_hide_pass(conn, line)); - } + e_debug(conn->event, "client in: %s", + auth_line_hide_pass(conn, line)); return auth_request_handler_auth_begin(conn->request_handler, args); } if (str_begins(line, "CONT\t", &args)) { - if (conn->auth->set->debug) { - e_debug(conn->event, "client in: %s", - cont_line_hide_pass(conn, line)); - } + e_debug(conn->event, "client in: %s", + cont_line_hide_pass(conn, line)); return auth_request_handler_auth_continue(conn->request_handler, args); } if (str_begins(line, "CANCEL\t", &args)) { - if (conn->auth->set->debug) - e_debug(conn->event, "client in: %s", line); + e_debug(conn->event, "client in: %s", line); return auth_client_cancel(conn, args); } diff --git a/src/auth/db-ldap.c b/src/auth/db-ldap.c index 0517cd3623..dde280bc59 100644 --- a/src/auth/db-ldap.c +++ b/src/auth/db-ldap.c @@ -1559,18 +1559,16 @@ get_ldap_fields(struct db_ldap_result_iterate_context *ctx, for (i = 0; i < count; i++) ldap_value->values[i] = p_strdup(ctx->pool, vals[i]); - if (ctx->debug != NULL) { - str_printfa(ctx->debug, " %s%s=", attr, suffix); - if (count == 0) - str_append(ctx->debug, ""); - else if (ldap_field_hide_password(ctx, attr)) - str_append(ctx->debug, PASSWORD_HIDDEN_STR); - else { - str_append(ctx->debug, ldap_value->values[0]); - for (i = 1; i < count; i++) { - str_printfa(ctx->debug, ",%s", - ldap_value->values[0]); - } + str_printfa(ctx->debug, " %s%s=", attr, suffix); + if (count == 0) + str_append(ctx->debug, ""); + else if (ldap_field_hide_password(ctx, attr)) + str_append(ctx->debug, PASSWORD_HIDDEN_STR); + else { + str_append(ctx->debug, ldap_value->values[0]); + for (i = 1; i < count; i++) { + str_printfa(ctx->debug, ",%s", + ldap_value->values[0]); } } hash_table_insert(ctx->ldap_attrs, @@ -1604,8 +1602,7 @@ db_ldap_result_iterate_init_full(struct ldap_connection *conn, ctx->iter_dn_values = iter_dn_values; hash_table_create(&ctx->ldap_attrs, pool, 0, strcase_hash, strcasecmp); ctx->var = str_new(ctx->pool, 256); - if (event_want_debug(ctx->ldap_request->auth_request->event)) - ctx->debug = t_str_new(256); + ctx->debug = t_str_new(256); ctx->ldap_msg = res; ctx->ld = conn->ld; @@ -1655,8 +1652,7 @@ db_ldap_field_expand(const char *data, void *context, ldap_value = hash_table_lookup(ctx->ldap_attrs, field_name); if (ldap_value == NULL) { /* requested ldap attribute wasn't returned at all */ - if (ctx->debug != NULL) - str_printfa(ctx->debug, "; %s missing", field_name); + str_printfa(ctx->debug, "; %s missing", field_name); *value_r = db_ldap_field_get_default(data); return 1; } @@ -1783,7 +1779,7 @@ bool db_ldap_result_iterate_next(struct db_ldap_result_iterate_context *ctx, hash_table_lookup(ctx->ldap_attrs, field->ldap_attr_name); if (ldap_value != NULL) ldap_value->used = TRUE; - else if (ctx->debug != NULL && *field->ldap_attr_name != '\0') + else if (*field->ldap_attr_name != '\0') str_printfa(ctx->debug, "; %s missing", field->ldap_attr_name); str_truncate(ctx->var, 0); @@ -1862,8 +1858,7 @@ void db_ldap_result_iterate_deinit(struct db_ldap_result_iterate_context **_ctx) *_ctx = NULL; - if (ctx->debug != NULL) - db_ldap_result_finish_debug(ctx); + db_ldap_result_finish_debug(ctx); hash_table_destroy(&ctx->ldap_attrs); pool_unref(&ctx->pool); } diff --git a/src/auth/db-lua.c b/src/auth/db-lua.c index dd4e77b25f..2ddb871e25 100644 --- a/src/auth/db-lua.c +++ b/src/auth/db-lua.c @@ -120,11 +120,9 @@ static int auth_request_lua_response_from_template(lua_State *L) static int auth_request_lua_log_debug(lua_State *L) { - if (global_auth_settings->debug) { - struct auth_request *request = auth_lua_check_auth_request(L, 1); - const char *msg = luaL_checkstring(L, 2); - e_debug(authdb_event(request), "db-lua: %s", msg); - } + struct auth_request *request = auth_lua_check_auth_request(L, 1); + const char *msg = luaL_checkstring(L, 2); + e_debug(authdb_event(request), "db-lua: %s", msg); return 0; }