diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-26 11:41:36 +0200 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-26 12:19:22 +0200 |
commit | afa99d6cb1443fbea654027c3ecaa4057b610000 (patch) | |
tree | ff0c17955d310a37e592e53ec0040370b1a9816c | |
parent | ef8d0e038475f5ce7e80842fcab332b3a1f98ad4 (diff) | |
download | rspamd-afa99d6cb1443fbea654027c3ecaa4057b610000.tar.gz rspamd-afa99d6cb1443fbea654027c3ecaa4057b610000.zip |
[Feature] Store enabled flag for webui session
-rw-r--r-- | src/controller.c | 11 | ||||
-rw-r--r-- | src/libserver/worker_util.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/controller.c b/src/controller.c index 8b5fdbaea..a3c6dd22f 100644 --- a/src/controller.c +++ b/src/controller.c @@ -505,6 +505,7 @@ static gboolean rspamd_controller_check_password( } else if (is_enable && (ctx->password == NULL && ctx->enable_password == NULL)) { + session->is_enable = TRUE; return TRUE; } } @@ -551,6 +552,10 @@ static gboolean rspamd_controller_check_password( "no password to check while executing a privileged command"); ret = FALSE; } + + if (ret) { + session->is_enable = TRUE; + } } else { /* Accept both normal and enable passwords */ @@ -594,6 +599,10 @@ static gboolean rspamd_controller_check_password( password, check, pbkdf, TRUE); } + + if (check_enable) { + session->is_enable = TRUE; + } } else { check_enable = FALSE; @@ -2246,6 +2255,8 @@ rspamd_controller_handle_stat_common ( task->http_conn = rspamd_http_connection_ref (conn_ent->conn);; task->sock = conn_ent->conn->fd; + ucl_object_insert_key (top, ucl_object_frombool (!session->is_enable), + "read_only", 0, false); ucl_object_insert_key (top, ucl_object_fromint ( stat->messages_scanned), "scanned", 0, false); ucl_object_insert_key (top, ucl_object_fromint ( diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h index 63a18a4fe..2ad312b0e 100644 --- a/src/libserver/worker_util.h +++ b/src/libserver/worker_util.h @@ -81,6 +81,7 @@ struct rspamd_controller_session { rspamd_inet_addr_t *from_addr; struct rspamd_config *cfg; gboolean is_spam; + gboolean is_enable; }; /** |