]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix a name and the description of bogus `user` field in the task
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Jan 2022 19:04:26 +0000 (19:04 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Jan 2022 19:04:26 +0000 (19:04 +0000)
src/libmime/mime_expressions.c
src/libmime/received.cxx
src/libserver/protocol.c
src/libserver/roll_history.c
src/libserver/task.c
src/libserver/task.h
src/lua/lua_task.c
src/plugins/dkim_check.c

index 0961195a28923857767ae2c00a637413d7d8321c..9d1362e287d5de193b196afd699aba09135e6b8f 100644 (file)
@@ -1723,7 +1723,7 @@ rspamd_check_smtp_data (struct rspamd_task *task, GArray * args, void *unused)
                case 'u':
                case 'U':
                        if (g_ascii_strcasecmp (type, "user") == 0) {
-                               str = task->user;
+                               str = task->auth_user;
                        }
                        else {
                                msg_warn_task ("bad argument to function: %s", type);
index c06331de49e4703ccc5d3a70affdaea02ca0dacd..6d8a847d66e58c3b442c15b3ae2345a94260c7ce 100644 (file)
@@ -725,7 +725,7 @@ received_maybe_fix_task(struct rspamd_task *task) -> bool
                                        trecv.flags |= received_flags::SSL;
                                }
 
-                               if (task->user) {
+                               if (task->auth_user) {
                                        trecv.flags |= received_flags::AUTHENTICATED;
                                }
 
index eb82a743fb337529862c6a9132d1f45912eb10dd..f09ec0b672d3cef13917fe788758aeff5be2d59a 100644 (file)
@@ -629,7 +629,7 @@ rspamd_protocol_handle_headers (struct rspamd_task *task,
                                         */
                                        msg_debug_protocol ("read user header, value: %T", hv_tok);
                                        if (!RSPAMD_TASK_IS_SPAMC (task)) {
-                                               task->user = rspamd_mempool_ftokdup (task->task_pool,
+                                               task->auth_user = rspamd_mempool_ftokdup (task->task_pool,
                                                                hv_tok);
                                        }
                                        else {
@@ -964,9 +964,9 @@ urls_protocol_cb (struct rspamd_url *url, struct tree_cb_data *cb)
        ucl_array_append (cb->top, obj);
 
        if (cb->task->cfg->log_urls) {
-               if (task->user) {
-                       user_field = task->user;
-                       len = strlen (task->user);
+               if (task->auth_user) {
+                       user_field = task->auth_user;
+                       len = strlen (task->auth_user);
                        has_user = TRUE;
                }
                else if (task->from_envelope) {
index a8c1c42a9bc16fec3813578f9321e0805afe958e..45b847923eb9249c642571d5fab9ab3190c82034 100644 (file)
@@ -144,8 +144,8 @@ rspamd_roll_history_update (struct roll_history *history,
                rspamd_strlcpy (row->message_id, MESSAGE_FIELD (task, message_id),
                                sizeof (row->message_id));
        }
-       if (task->user) {
-               rspamd_strlcpy (row->user, task->user, sizeof (row->user));
+       if (task->auth_user) {
+               rspamd_strlcpy (row->user, task->auth_user, sizeof (row->user));
        }
        else {
                row->user[0] = '\0';
index fa97d67a5cc713e9620d21864e2db566ec58e164..244327b49c4735e0792176df4b2b2c00481ffde7 100644 (file)
@@ -991,7 +991,7 @@ rspamd_task_log_check_condition (struct rspamd_task *task,
                }
                break;
        case RSPAMD_LOG_USER:
-               if (task->user) {
+               if (task->auth_user) {
                        ret = TRUE;
                }
                break;
@@ -1424,8 +1424,8 @@ rspamd_task_log_variable (struct rspamd_task *task,
                }
                break;
        case RSPAMD_LOG_USER:
-               if (task->user) {
-                       var.begin = task->user;
+               if (task->auth_user) {
+                       var.begin = task->auth_user;
                        var.len = strlen (var.begin);
                }
                else {
index ca49ed1e09f7c27e595000afb578dccd9c2e6c51..ca10c010591851f40b412e95200add0e17522779 100644 (file)
@@ -173,7 +173,7 @@ struct rspamd_task {
        rspamd_inet_addr_t *from_addr;                    /**< from addr for a task                                                     */
        rspamd_inet_addr_t *client_addr;                /**< address of connected socket                                        */
        gchar *deliver_to;                                /**< address to deliver                                                               */
-       gchar *user;                                    /**< user to deliver                                                            */
+       gchar *auth_user;                                /**< SMTP authenticated user                                                           */
        const gchar *hostname;                            /**< hostname reported by MTA                                         */
        khash_t(rspamd_req_headers_hash) *request_headers; /**< HTTP headers in a request                                               */
        struct rspamd_task_data_storage msg;            /**< message buffer                                                                     */
index 3fb61f9d422c6bb0f24ccb970ef5bf30d9b56362..b0ddc5e42741f4bd73efbe82d849cffb228968ce 100644 (file)
@@ -4144,8 +4144,8 @@ lua_task_get_user (lua_State *L)
        struct rspamd_task *task = lua_check_task (L, 1);
 
        if (task) {
-               if (task->user != NULL) {
-                       lua_pushstring (L, task->user);
+               if (task->auth_user != NULL) {
+                       lua_pushstring (L, task->auth_user);
                }
                else {
                        lua_pushnil (L);
@@ -4170,27 +4170,27 @@ lua_task_set_user (lua_State *L)
                if (lua_type (L, 2) == LUA_TSTRING) {
                        new_user = lua_tostring (L, 2);
 
-                       if (task->user) {
+                       if (task->auth_user) {
                                /* Push old user */
-                               lua_pushstring (L, task->user);
+                               lua_pushstring (L, task->auth_user);
                        }
                        else {
                                lua_pushnil (L);
                        }
 
-                       task->user = rspamd_mempool_strdup (task->task_pool, new_user);
+                       task->auth_user = rspamd_mempool_strdup (task->task_pool, new_user);
                }
                else {
                        /* Reset user */
-                       if (task->user) {
+                       if (task->auth_user) {
                                /* Push old user */
-                               lua_pushstring (L, task->user);
+                               lua_pushstring (L, task->auth_user);
                        }
                        else {
                                lua_pushnil (L);
                        }
 
-                       task->user = NULL;
+                       task->auth_user = NULL;
                }
        }
        else {
index ab5d6ec4342d04512c6f6f3cb2d06a2b529d2506..039cdf71812a16e60c2000151387d10b3e6f6869 100644 (file)
@@ -1154,7 +1154,7 @@ dkim_symbol_callback (struct rspamd_task *task,
        }
 
        /* First check if plugin should be enabled */
-       if ((!dkim_module_ctx->check_authed && task->user != NULL)
+       if ((!dkim_module_ctx->check_authed && task->auth_user != NULL)
                        || (!dkim_module_ctx->check_local &&
                        rspamd_ip_is_local_cfg (task->cfg, task->from_addr))) {
                msg_info_task ("skip DKIM checks for local networks and authorized users");