]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add some fail safety
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 22 Jan 2019 16:32:52 +0000 (16:32 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 22 Jan 2019 16:32:52 +0000 (16:32 +0000)
src/plugins/dkim_check.c

index 83272a585f5c7e6cdd4c83740ed370b04198f4d3..a203edc3d0c6661322e242161877a593f83496e9 100644 (file)
@@ -1606,10 +1606,33 @@ dkim_module_lua_push_verify_result (struct rspamd_dkim_lua_verify_cbdata *cbd,
        lua_pushstring (cbd->L, error_str);
 
        if (cbd->ctx) {
-               lua_pushstring (cbd->L, res->domain);
-               lua_pushstring (cbd->L, res->selector);
-               lua_pushstring (cbd->L, res->short_b);
-               lua_pushstring (cbd->L, res->fail_reason);
+               if (res->domain) {
+                       lua_pushstring (cbd->L, res->domain);
+               }
+               else {
+                       lua_pushnil (cbd->L);
+               }
+
+               if (res->selector) {
+                       lua_pushstring (cbd->L, res->selector);
+               }
+               else {
+                       lua_pushnil (cbd->L);
+               }
+
+               if (res->short_b) {
+                       lua_pushstring (cbd->L, res->short_b);
+               }
+               else {
+                       lua_pushnil (cbd->L);
+               }
+
+               if (res->fail_reason) {
+                       lua_pushstring (cbd->L, res->fail_reason);
+               }
+               else {
+                       lua_pushnil (cbd->L);
+               }
        }
        else {
                lua_pushnil (cbd->L);