From 8a4c5ca57ae66ad31f64c348d15d6b22112c8dad Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 16 Jan 2019 15:04:27 +0000 Subject: [Feature] Core: Normalise zero-width spaces in urls --- src/libutil/str_util.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/libutil/str_util.h') 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 { -- cgit v1.2.3