aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-16 16:42:23 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-03-16 16:42:23 +0000
commit68cfcc69fb8217cc09f6b0bfe67d828c95bbc598 (patch)
tree8dd87eaf25f2f00835d87b689866fbe4de551806 /src
parent4a3b3d8e636e8045540d7fc822b02533bea6f2df (diff)
downloadrspamd-68cfcc69fb8217cc09f6b0bfe67d828c95bbc598.tar.gz
rspamd-68cfcc69fb8217cc09f6b0bfe67d828c95bbc598.zip
[Fix] Fix couple of issues with arguments in lua_redis
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_redis.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 4f09c3a96..abd25a93f 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -351,7 +351,9 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
top = 1;
while (lua_next (L, -2) != 0) {
- args[top++] = g_strdup (lua_tostring (L, -1));
+ if (lua_isstring (L, -1)) {
+ args[top++] = g_strdup (lua_tostring (L, -1));
+ }
lua_pop (L, 1);
}
@@ -874,10 +876,18 @@ lua_redis_connect_sync (lua_State *L)
}
if (ctx->d.sync == NULL || ctx->d.sync->err) {
- REF_RELEASE (ctx);
lua_pushboolean (L, FALSE);
- return 1;
+ if (ctx->d.sync) {
+ lua_pushstring (L, ctx->d.sync->errstr);
+ }
+ else {
+ lua_pushstring (L, "unknown error");
+ }
+
+ REF_RELEASE (ctx);
+
+ return 2;
}
pctx = lua_newuserdata (L, sizeof (ctx));
@@ -889,8 +899,10 @@ lua_redis_connect_sync (lua_State *L)
if (ip) {
rspamd_inet_address_destroy (ip);
}
- msg_err ("bad arguments for redis request");
+
lua_pushboolean (L, FALSE);
+ lua_pushstring (L, "bad arguments for redis request");
+ return 2;
}
return 1;