summaryrefslogtreecommitdiffstats
path: root/src/libutil/str_util.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-16 15:04:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-16 15:04:27 +0000
commit8a4c5ca57ae66ad31f64c348d15d6b22112c8dad (patch)
tree1e4f71dea9cb2c1cbf22839009157a8b84c18aca /src/libutil/str_util.h
parentf3ff58dd3b28a283020a9ea54113f6295041fad5 (diff)
downloadrspamd-8a4c5ca57ae66ad31f64c348d15d6b22112c8dad.tar.gz
rspamd-8a4c5ca57ae66ad31f64c348d15d6b22112c8dad.zip
[Feature] Core: Normalise zero-width spaces in urls
Diffstat (limited to 'src/libutil/str_util.h')
-rw-r--r--src/libutil/str_util.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h
index 742d34184..059665388 100644
--- a/src/libutil/str_util.h
+++ b/src/libutil/str_util.h
@@ -402,6 +402,14 @@ struct UConverter *rspamd_get_utf8_converter (void);
struct UNormalizer2;
const struct UNormalizer2 *rspamd_get_unicode_normalizer (void);
+enum rspamd_normalise_result {
+ RSPAMD_UNICODE_NORM_NORMAL = 0,
+ RSPAMD_UNICODE_NORM_UNNORMAL = (1 << 0),
+ RSPAMD_UNICODE_NORM_ZERO_SPACES = (1 << 1),
+ RSPAMD_UNICODE_NORM_ERROR = (1 << 2),
+ RSPAMD_UNICODE_NORM_OVERFLOW = (1 << 3)
+};
+
/**
* Gets a string in UTF8 and normalises it to NFKC_Casefold form
* @param pool optional memory pool used for logging purposes
@@ -409,7 +417,7 @@ const struct UNormalizer2 *rspamd_get_unicode_normalizer (void);
* @param len
* @return TRUE if a string has been normalised
*/
-gboolean rspamd_normalise_unicode_inplace (rspamd_mempool_t *pool,
+enum rspamd_normalise_result rspamd_normalise_unicode_inplace (rspamd_mempool_t *pool,
gchar *start, guint *len);
enum rspamd_regexp_escape_flags {