diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_tcp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index 8d948c6d5..61a73acf8 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -990,10 +990,10 @@ lua_tcp_request (lua_State *L) gsize plen = 0; struct event_base *ev_base; struct lua_tcp_cbdata *cbd; - struct rspamd_dns_resolver *resolver; + struct rspamd_dns_resolver *resolver = NULL; struct rspamd_async_session *session = NULL; struct rspamd_task *task = NULL; - struct rspamd_config *cfg; + struct rspamd_config *cfg = NULL; struct iovec *iov = NULL; guint niov = 0, total_out; guint64 h; @@ -1194,6 +1194,13 @@ lua_tcp_request (lua_State *L) return 1; } + if (resolver == NULL && cfg == NULL && task == NULL) { + msg_err ("tcp request has bad params: one of {resolver,task,config} should be set"); + lua_pushboolean (L, FALSE); + + return 1; + } + cbd->task = task; h = rspamd_random_uint64_fast (); rspamd_snprintf (cbd->tag, sizeof (cbd->tag), "%uxL", h); |