aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-24 10:45:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-02-24 10:45:55 +0000
commit5fca00b1f15cc38361879baa78aced1f9d34f53c (patch)
treee7085afa4dd5e5b732418aaa5d0aea79fcfaada3 /src/lua/lua_util.c
parent0cfa74936ae8a09e57bc6112b873c97e6fa51cb8 (diff)
downloadrspamd-5fca00b1f15cc38361879baa78aced1f9d34f53c.tar.gz
rspamd-5fca00b1f15cc38361879baa78aced1f9d34f53c.zip
[Minor] Add reason of confusing
Diffstat (limited to 'src/lua/lua_util.c')
-rw-r--r--src/lua/lua_util.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index aaf1c609c..680a75ece 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -1899,7 +1899,7 @@ static gint
lua_util_is_utf_spoofed (lua_State *L)
{
gsize l1, l2;
- gint ret;
+ gint ret, nres = 2;
const gchar *s1 = lua_tolstring (L, 1, &l1), *s2 = lua_tolstring (L, 2, &l2);
static USpoofChecker *spc;
UErrorCode uc_err = U_ZERO_ERROR;
@@ -1918,12 +1918,31 @@ lua_util_is_utf_spoofed (lua_State *L)
ret = uspoof_areConfusableUTF8 (spc, s1, l1, s2, l2, &uc_err);
lua_pushboolean (L, !!(ret != 0));
+ msg_err ("ret: %d", ret);
+
+ switch (ret) {
+ case 0:
+ nres = 1;
+ break;
+ case USPOOF_SINGLE_SCRIPT_CONFUSABLE:
+ lua_pushstring (L, "single");
+ break;
+ case USPOOF_MIXED_SCRIPT_CONFUSABLE:
+ lua_pushstring (L, "multiple");
+ break;
+ case USPOOF_WHOLE_SCRIPT_CONFUSABLE:
+ lua_pushstring (L, "whole");
+ break;
+ default:
+ lua_pushstring (L, "unknown");
+ break;
+ }
}
else {
return luaL_error (L, "invalid arguments");
}
- return 1;
+ return nres;
}
static gint