From: Vsevolod Stakhov Date: Wed, 6 Feb 2019 14:17:59 +0000 (+0000) Subject: [Minor] Add function to test character for domain safety X-Git-Tag: 1.9.0~209 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6007d9d998b15934641b002c9d99ffd43a9a70cf;p=rspamd.git [Minor] Add function to test character for domain safety --- diff --git a/src/libserver/url.c b/src/libserver/url.c index 4dcd11c9e..421c8a181 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -3323,3 +3323,9 @@ rspamd_url_encode (struct rspamd_url *url, gsize *pdlen, return (const gchar *)dest; } + +gboolean +rspamd_url_is_domain (int c) +{ + return is_domain ((guchar)c); +} diff --git a/src/libserver/url.h b/src/libserver/url.h index 523fb2c1f..4c34be9e7 100644 --- a/src/libserver/url.h +++ b/src/libserver/url.h @@ -232,4 +232,12 @@ gsize rspamd_url_decode (gchar *dst, const gchar *src, gsize size); const gchar * rspamd_url_encode (struct rspamd_url *url, gsize *dlen, rspamd_mempool_t *pool); + +/** + * Returns if a character is domain character + * @param c + * @return + */ +gboolean rspamd_url_is_domain (int c); + #endif