diff options
author | Steven Barth <steven@midlink.org> | 2009-02-23 17:21:14 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-02-23 17:21:14 +0000 |
commit | 6b104b9a458db6c2a1624085121814e7c8cbb014 (patch) | |
tree | 08b22ae96d2981700f0b03ad5487470bb40cf6b8 /libs/nixio/src/tls-context.c | |
parent | 65b50a8f8a95d0d091a3f16ba5574842840c7289 (diff) |
nixio:
Reogranize TLS headers
Fix TLS receive buffer workaround for axTLS
Add support for flock()
Diffstat (limited to 'libs/nixio/src/tls-context.c')
-rw-r--r-- | libs/nixio/src/tls-context.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libs/nixio/src/tls-context.c b/libs/nixio/src/tls-context.c index 723f8a85fd..ff3feeb4d3 100644 --- a/libs/nixio/src/tls-context.c +++ b/libs/nixio/src/tls-context.c @@ -16,12 +16,8 @@ * limitations under the License. */ -#include "nixio.h" -#include "string.h" - -#ifndef WITHOUT_OPENSSL -#include <openssl/ssl.h> -#endif +#include "nixio-tls.h" +#include <string.h> static SSL_CTX* nixio__checktlsctx(lua_State *L) { SSL_CTX **ctx = (SSL_CTX **)luaL_checkudata(L, 1, NIXIO_TLS_CTX_META); @@ -78,21 +74,22 @@ static int nixio_tls_ctx_create(lua_State *L) { SSL_CTX *ctx = nixio__checktlsctx(L); int fd = nixio__checkfd(L, 2); - SSL **sock = lua_newuserdata(L, sizeof(SSL *)); + nixio_tls_sock *sock = lua_newuserdata(L, sizeof(nixio_tls_sock)); if (!sock) { return luaL_error(L, "out of memory"); } + memset(sock, 0, sizeof(nixio_tls_sock)); /* create userdata */ luaL_getmetatable(L, NIXIO_TLS_SOCK_META); lua_setmetatable(L, -2); - *sock = SSL_new(ctx); - if (!(*sock)) { + sock->socket = SSL_new(ctx); + if (!sock->socket) { return nixio__tls_perror(L, 0); } - if (SSL_set_fd(*sock, fd) != 1) { + if (SSL_set_fd(sock->socket, fd) != 1) { return nixio__tls_perror(L, 0); } |