commit 19bfd5e: [Minor] Fix a name and the description of bogus `user` field in the task
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Jan 24 19:49:04 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-01-24 19:04:26 +0000
URL: https://github.com/rspamd/rspamd/commit/19bfd5e302954bf2ce1f892dc46ba1bb08c15aa8 (HEAD -> master)
[Minor] Fix a name and the description of bogus `user` field in the task
---
src/libmime/mime_expressions.c | 2 +-
src/libmime/received.cxx | 2 +-
src/libserver/protocol.c | 8 ++++----
src/libserver/roll_history.c | 4 ++--
src/libserver/task.c | 6 +++---
src/libserver/task.h | 2 +-
src/lua/lua_task.c | 16 ++++++++--------
src/plugins/dkim_check.c | 2 +-
8 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 0961195a2..9d1362e28 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -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);
diff --git a/src/libmime/received.cxx b/src/libmime/received.cxx
index c06331de4..6d8a847d6 100644
--- a/src/libmime/received.cxx
+++ b/src/libmime/received.cxx
@@ -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;
}
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c
index eb82a743f..f09ec0b67 100644
--- a/src/libserver/protocol.c
+++ b/src/libserver/protocol.c
@@ -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) {
diff --git a/src/libserver/roll_history.c b/src/libserver/roll_history.c
index a8c1c42a9..45b847923 100644
--- a/src/libserver/roll_history.c
+++ b/src/libserver/roll_history.c
@@ -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';
diff --git a/src/libserver/task.c b/src/libserver/task.c
index fa97d67a5..244327b49 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -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 {
diff --git a/src/libserver/task.h b/src/libserver/task.h
index ca49ed1e0..ca10c0105 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -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 */
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 3fb61f9d4..b0ddc5e42 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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 {
diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c
index ab5d6ec43..039cdf718 100644
--- a/src/plugins/dkim_check.c
+++ b/src/plugins/dkim_check.c
@@ -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");
More information about the Commits
mailing list