diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-27 12:03:54 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-03-27 12:03:54 +0000 |
commit | 2ad0276a3189c61e673ea716dbd461ac6ee59f87 (patch) | |
tree | 45acbd68e2c2e28eeb445c90a61ecbb7689b20a5 /src/libutil | |
parent | df2fba1c90b25c486d4c33f6c99b2cc2d768063c (diff) | |
download | rspamd-2ad0276a3189c61e673ea716dbd461ac6ee59f87.tar.gz rspamd-2ad0276a3189c61e673ea716dbd461ac6ee59f87.zip |
[Minor] Pass variables from the environment to rspamd_env
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/str_util.h | 3 | ||||
-rw-r--r-- | src/libutil/upstream.c | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index 9145b97b4..91efdf187 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -502,4 +502,7 @@ const gchar* rspamd_string_len_strip (const gchar *in, ((uc) >= 0x205F && (uc) <= 0x206F) || \ (uc) == 0xFEFF) +#define RSPAMD_LEN_CHECK_STARTS_WITH(s, len, lit) \ + ((len) >= sizeof(lit) - 1 && g_ascii_strncasecmp ((s), (lit), sizeof(lit) - 1) == 0) + #endif /* SRC_LIBUTIL_STR_UTIL_H_ */ diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 3a2b803b4..3e04e68e9 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -788,8 +788,6 @@ rspamd_upstream_add_addr (struct upstream *up, rspamd_inet_addr_t *addr) return TRUE; } -#define LEN_CHECK_STARTS_WITH(s, len, lit) \ - ((len) >= sizeof(lit) - 1 && g_ascii_strncasecmp ((s), (lit), sizeof(lit) - 1) == 0) gboolean rspamd_upstreams_parse_line_len (struct upstream_list *ups, const gchar *str, gsize len, guint16 def_port, void *data) @@ -800,23 +798,23 @@ rspamd_upstreams_parse_line_len (struct upstream_list *ups, guint span_len; gboolean ret = FALSE; - if (LEN_CHECK_STARTS_WITH(p, len, "random:")) { + if (RSPAMD_LEN_CHECK_STARTS_WITH(p, len, "random:")) { ups->rot_alg = RSPAMD_UPSTREAM_RANDOM; p += sizeof ("random:") - 1; } - else if (LEN_CHECK_STARTS_WITH(p, len, "master-slave:")) { + else if (RSPAMD_LEN_CHECK_STARTS_WITH(p, len, "master-slave:")) { ups->rot_alg = RSPAMD_UPSTREAM_MASTER_SLAVE; p += sizeof ("master-slave:") - 1; } - else if (LEN_CHECK_STARTS_WITH(p, len, "round-robin:")) { + else if (RSPAMD_LEN_CHECK_STARTS_WITH(p, len, "round-robin:")) { ups->rot_alg = RSPAMD_UPSTREAM_ROUND_ROBIN; p += sizeof ("round-robin:") - 1; } - else if (LEN_CHECK_STARTS_WITH(p, len, "hash:")) { + else if (RSPAMD_LEN_CHECK_STARTS_WITH(p, len, "hash:")) { ups->rot_alg = RSPAMD_UPSTREAM_HASHED; p += sizeof ("hash:") - 1; } - else if (LEN_CHECK_STARTS_WITH(p, len, "sequential:")) { + else if (RSPAMD_LEN_CHECK_STARTS_WITH(p, len, "sequential:")) { ups->rot_alg = RSPAMD_UPSTREAM_SEQUENTIAL; p += sizeof ("sequential:") - 1; } @@ -847,7 +845,6 @@ rspamd_upstreams_parse_line_len (struct upstream_list *ups, return ret; } -#undef LEN_CHECK_STARTS_WITH gboolean rspamd_upstreams_parse_line (struct upstream_list *ups, |