diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-06 14:17:59 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-06 14:17:59 +0000 |
commit | 6007d9d998b15934641b002c9d99ffd43a9a70cf (patch) | |
tree | 979a9f700c5c5daa99b92c6e09af50b31b98ec12 | |
parent | 210bbf027268137a23e8f10181225ffb5bb97cdc (diff) | |
download | rspamd-6007d9d998b15934641b002c9d99ffd43a9a70cf.tar.gz rspamd-6007d9d998b15934641b002c9d99ffd43a9a70cf.zip |
[Minor] Add function to test character for domain safety
-rw-r--r-- | src/libserver/url.c | 6 | ||||
-rw-r--r-- | src/libserver/url.h | 8 |
2 files changed, 14 insertions, 0 deletions
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 |