]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Remove extraneous debug check when calling e_debug()
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Tue, 15 Mar 2022 13:49:58 +0000 (14:49 +0100)
committerKarl Fleischmann <karl.fleischmann@open-xchange.com>
Wed, 6 Apr 2022 07:03:16 +0000 (10:03 +0300)
Remove checks for debug setting when calling e_debug() as it is already
doing the necessary check.

src/auth/auth-client-connection.c
src/auth/db-ldap.c
src/auth/db-lua.c

index 902967d2a8c1ad1bb50859349f3108098b5144a8..9c1a7b604fde9f8278afd13b75d0ae9c9e220b25 100644 (file)
@@ -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);
        }
 
index 0517cd36231a893f23d6553a5b86b9f2c54c0dc1..dde280bc598f432e1d7f8fe92a3acdb5ba2330ac 100644 (file)
@@ -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, "<no values>");
-                       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, "<no values>");
+               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);
 }
index dd4e77b25f0a060914c0115728813a297e38c82f..2ddb871e2537d1eaefc84ee2dedd01257d8829dc 100644 (file)
@@ -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;
 }