From: Vsevolod Stakhov Date: Fri, 24 Feb 2017 10:45:14 +0000 (+0000) Subject: [Minor] Add reason of confusing X-Git-Tag: 1.5.0~41 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5fca00b1f15cc38361879baa78aced1f9d34f53c;p=rspamd.git [Minor] Add reason of confusing --- 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