mirror of
https://github.com/brunoos/luasec.git
synced 2025-02-13 15:32:48 +01:00
Fix check for error in DANE functions
This commit is contained in:
parent
a2dcfffcfa
commit
8722f83e8f
@ -709,9 +709,10 @@ static int set_alpn_cb(lua_State *L)
|
|||||||
*/
|
*/
|
||||||
static int set_dane(lua_State *L)
|
static int set_dane(lua_State *L)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
SSL_CTX *ctx = lsec_checkcontext(L, 1);
|
SSL_CTX *ctx = lsec_checkcontext(L, 1);
|
||||||
int ret = SSL_CTX_dane_enable(ctx);
|
ret = SSL_CTX_dane_enable(ctx);
|
||||||
lua_pushboolean(L, ret);
|
lua_pushboolean(L, (ret > 0));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
14
src/ssl.c
14
src/ssl.c
@ -829,24 +829,26 @@ static int meth_copyright(lua_State *L)
|
|||||||
#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
|
#if (OPENSSL_VERSION_NUMBER >= 0x1010000fL)
|
||||||
static int meth_dane(lua_State *L)
|
static int meth_dane(lua_State *L)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
||||||
int ret = SSL_dane_enable(ssl->ssl, luaL_checkstring(L, 2));
|
ret = SSL_dane_enable(ssl->ssl, luaL_checkstring(L, 2));
|
||||||
lua_pushboolean(L, ret);
|
lua_pushboolean(L, (ret > 0));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int meth_tlsa(lua_State *L)
|
static int meth_tlsa(lua_State *L)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
size_t len;
|
||||||
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
||||||
uint8_t usage = luaL_checkinteger(L, 2);
|
uint8_t usage = luaL_checkinteger(L, 2);
|
||||||
uint8_t selector = luaL_checkinteger(L, 3);
|
uint8_t selector = luaL_checkinteger(L, 3);
|
||||||
uint8_t mtype = luaL_checkinteger(L, 4);
|
uint8_t mtype = luaL_checkinteger(L, 4);
|
||||||
size_t len;
|
unsigned char *data = (unsigned char*)luaL_checklstring(L, 5, &len);
|
||||||
const char *data = luaL_checklstring(L, 5, &len);
|
|
||||||
|
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
int ret = SSL_dane_tlsa_add(ssl->ssl, usage, selector, mtype, data, len);
|
ret = SSL_dane_tlsa_add(ssl->ssl, usage, selector, mtype, data, len);
|
||||||
lua_pushboolean(L, ret);
|
lua_pushboolean(L, (ret > 0));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user