aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controller.c23
-rw-r--r--src/smtp_proxy.c8
2 files changed, 18 insertions, 13 deletions
diff --git a/src/controller.c b/src/controller.c
index 6bee8cf57..d02508f07 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -139,8 +139,8 @@ struct rspamd_controller_worker_ctx {
/* Privilleged password */
gchar *enable_password;
/* Cached versions of the passwords */
- rspamd_fstring_t cached_password;
- rspamd_fstring_t cached_enable_password;
+ rspamd_ftok_t cached_password;
+ rspamd_ftok_t cached_enable_password;
/* HTTP server */
struct rspamd_http_connection_router *http;
/* Server's start time */
@@ -261,7 +261,8 @@ rspamd_check_encrypted_password (struct rspamd_controller_worker_ctx *ctx,
gsize salt_len, key_len;
gboolean ret = TRUE;
guchar *local_key;
- rspamd_fstring_t *cache;
+ rspamd_ftok_t *cache;
+ gpointer m;
/* First of all check cached versions to save resources */
if (is_enable && ctx->cached_enable_password.len != 0) {
@@ -332,11 +333,12 @@ rspamd_check_encrypted_password (struct rspamd_controller_worker_ctx *ctx,
if (cache->len == 0) {
/* Mmap region */
- cache->begin = mmap (NULL, password->len, PROT_WRITE,
+ m = mmap (NULL, password->len, PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
- memcpy (cache->begin, password->str, password->len);
- (void)mprotect (cache->begin, password->len, PROT_READ);
- (void)mlock (cache->begin, password->len);
+ memcpy (m, password->str, password->len);
+ (void)mprotect (m, password->len, PROT_READ);
+ (void)mlock (m, password->len);
+ cache->begin = m;
cache->len = password->len;
}
}
@@ -2386,6 +2388,7 @@ start_controller_worker (struct rspamd_worker *worker)
gpointer key, value;
struct rspamd_keypair_cache *cache;
gchar *secure_ip;
+ gpointer m;
ctx->ev_base = rspamd_prepare_worker (worker,
"controller",
@@ -2556,11 +2559,13 @@ start_controller_worker (struct rspamd_worker *worker)
}
if (ctx->cached_password.len > 0) {
- munmap (ctx->cached_password.begin, ctx->cached_password.len);
+ m = (gpointer)ctx->cached_password.begin;
+ munmap (m, ctx->cached_password.len);
}
if (ctx->cached_enable_password.len > 0) {
- munmap (ctx->cached_enable_password.begin, ctx->cached_enable_password.len);
+ m = (gpointer) ctx->cached_enable_password.begin;
+ munmap (m, ctx->cached_enable_password.len);
}
exit (EXIT_SUCCESS);
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c
index b931a7890..43119afa2 100644
--- a/src/smtp_proxy.c
+++ b/src/smtp_proxy.c
@@ -734,9 +734,9 @@ smtp_dns_cb (struct rdns_reply *reply, void *arg)
}
static void
-proxy_parse_smtp_input (rspamd_fstring_t *line, struct smtp_proxy_session *session)
+proxy_parse_smtp_input (rspamd_ftok_t *line, struct smtp_proxy_session *session)
{
- gchar *p, *c, *end;
+ const gchar *p, *c, *end;
gsize len;
p = line->begin;
@@ -788,10 +788,10 @@ proxy_parse_smtp_input (rspamd_fstring_t *line, struct smtp_proxy_session *sessi
* Callback that is called when there is data to read in buffer
*/
static gboolean
-smtp_proxy_read_socket (rspamd_fstring_t * in, void *arg)
+smtp_proxy_read_socket (rspamd_ftok_t * in, void *arg)
{
struct smtp_proxy_session *session = arg;
- gchar *p;
+ const gchar *p;
if (session->state != SMTP_PROXY_STATE_REJECT_EMULATE) {
/* This can be called only if client is using invalid pipelining */