A few ifdef missing when SSL is not compiled in HAProxy:
diff --git a/src/hlua.c b/src/hlua.c
index a0e4d91..3d69c5d 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1542,6 +1542,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
return 0;
}
+#ifdef USE_OPENSSL
__LJMP static int hlua_socket_connect_ssl(struct lua_State *L)
{
struct hlua_socket *socket;
@@ -1551,6 +1552,7 @@ __LJMP static int hlua_socket_connect_ssl(struct
lua_State *L)
socket->s->target = &socket_ssl.obj_type;
return MAY_LJMP(hlua_socket_connect(L));
}
+#endif
__LJMP static int hlua_socket_setoption(struct lua_State *L)
{
@@ -3563,7 +3565,9 @@ void hlua_init(void)
lua_pushstring(gL.T, "__index");
lua_newtable(gL.T);
+#ifdef USE_OPENSSL
hlua_class_function(gL.T, "connect_ssl", hlua_socket_connect_ssl);
+#endif
hlua_class_function(gL.T, "connect", hlua_socket_connect);
hlua_class_function(gL.T, "send", hlua_socket_send);
hlua_class_function(gL.T, "receive", hlua_socket_receive);
Baptiste
On Sun, Mar 1, 2015 at 6:22 PM, Cyril Bonté <[email protected]> wrote:
> Hi Tierry,
>
> Huge work ! I've not played with it yet, but I've already compiled it
> successfully ;-)
>
> Some early feedbacks :
> - It appears that the code requires at least LUA 5.2.
>
> - Maybe we'll have to work on the Makefile to ease the compilation. For
> example, on debian, I have to add -llua5.2 instead of -llua
>
> - There's a small typo in an error message (hlua.c:423) : "Malformad
> argument mask" instead of "Malformed argument mask" for the
> hlua_lua2arg_check() function.
> I'll send a patch later for that.
>
> - Talking about hlua_lua2arg_check(), There are 2 other points :
> 1. The function comments has some typos. While trying to fix them, I'm
> realizing I don't understand the comment and I'm not sure to rewrite it
> correctly. Can you have a look at it ?
> 2. I think we can have a buffer overflow with the following test :
> if (idx >= ARGM_NBARGS && argp[idx].type != ARGT_STOP)
>
> The calling function (hlua_run_sample_fetch) already allows a same buffer
> overflow :
> struct arg args[ARGM_NBARGS];
> and
> args[i].type = ARGT_STOP;
> where `i' can be equal to ARGM_NBARGS.
>
> - As it is done for other libraries, maybe we can add the compiled version
> of LUA when "haproxy -vv" is called.
> I'll also send a patch for that.
>
> - Still about the version : maybe we can add a #error when LUA_VERSION_NUM
> is not defined or less than 502 :
> # LUA 5.0.x : not devined
> # LUA 5.1.x : equal to 501
> # LUA 5.2.x : equal to 502
> # LUA 5.3.x : equal to 503
>
> I think I'll try some LUA scripts before the end of the week-end (which is
> approaching too quickly) ;-)
>
> --
> Cyril Bonté
>