summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/tls-context.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-02-23 17:21:14 +0000
committerSteven Barth <steven@midlink.org>2009-02-23 17:21:14 +0000
commit6b104b9a458db6c2a1624085121814e7c8cbb014 (patch)
tree08b22ae96d2981700f0b03ad5487470bb40cf6b8 /libs/nixio/src/tls-context.c
parent65b50a8f8a95d0d091a3f16ba5574842840c7289 (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.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/libs/nixio/src/tls-context.c b/libs/nixio/src/tls-context.c
index 723f8a85f..ff3feeb4d 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);
}