aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-11 09:57:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-10-11 09:57:20 +0100
commitd9f755c976a708b8a9836ed83f05bdd290b55d54 (patch)
tree62aa10f980a03b73111543cecd4217a5098151bb /src/lua
parentf0004af0229a615d166716ed65ea1c3aff11f9fb (diff)
downloadrspamd-d9f755c976a708b8a9836ed83f05bdd290b55d54.tar.gz
rspamd-d9f755c976a708b8a9836ed83f05bdd290b55d54.zip
[Minor] Distinguish absent IP address in a more sane way
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index b04596ed3..97523a1fa 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -3843,7 +3843,12 @@ lua_task_get_from_ip (lua_State *L)
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
- rspamd_lua_ip_push (L, task->from_addr);
+ if (task->from_addr) {
+ rspamd_lua_ip_push (L, task->from_addr);
+ }
+ else {
+ lua_pushnil (L);
+ }
}
else {
return luaL_error (L, "invalid arguments");
@@ -3901,7 +3906,12 @@ lua_task_get_client_ip (lua_State *L)
struct rspamd_task *task = lua_check_task (L, 1);
if (task) {
- rspamd_lua_ip_push (L, task->client_addr);
+ if (task->client_addr) {
+ rspamd_lua_ip_push (L, task->client_addr);
+ }
+ else {
+ lua_pushnil (L);
+ }
}
else {
return luaL_error (L, "invalid arguments");