diff --git a/CHANGELOG b/CHANGELOG index 157247b..141fdbb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +-------------------------------------------------------------------------------- +LuaSec 0.3.3 +------------ +- BUG: Clear the error queue before call I/O functions (see SSL_get_error + manual). + (thanks Matthew Wild) + -------------------------------------------------------------------------------- LuaSec 0.3.2 ------------ diff --git a/INSTALL b/INSTALL index d673c12..0bb29ad 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -LuaSec 0.3.2 +LuaSec 0.3.3 ------------ * On Linux, BSD, and Mac OS X: diff --git a/LICENSE b/LICENSE index a54ad24..80b9c29 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -LuaSec 0.3.2 license +LuaSec 0.3.3 license Copyright (C) 2006-2009 Bruno Silvestre Permission is hereby granted, free of charge, to any person obtaining diff --git a/src/context.c b/src/context.c index 7a5d07f..4113ebf 100644 --- a/src/context.c +++ b/src/context.c @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- - * LuaSec 0.3.2 + * LuaSec 0.3.3 * Copyright (C) 2006-2009 Bruno Silvestre * *--------------------------------------------------------------------------*/ diff --git a/src/context.h b/src/context.h index e75242e..883eea4 100644 --- a/src/context.h +++ b/src/context.h @@ -2,7 +2,7 @@ #define __CONTEXT_H__ /*-------------------------------------------------------------------------- - * LuaSec 0.3.2 + * LuaSec 0.3.3 * Copyright (C) 2006-2009 Bruno Silvestre * *--------------------------------------------------------------------------*/ diff --git a/src/ssl.c b/src/ssl.c index ff1d5e8..dbdfb84 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -1,5 +1,5 @@ /*-------------------------------------------------------------------------- - * LuaSec 0.3.2 + * LuaSec 0.3.3 * Copyright (C) 2006-2009 Bruno Silvestre * *--------------------------------------------------------------------------*/ @@ -63,11 +63,13 @@ static int meth_destroy(lua_State *L) */ static int handshake(p_ssl ssl) { + int err; p_timeout tm = timeout_markstart(&ssl->tm); if (ssl->state == ST_SSL_CLOSED) return IO_CLOSED; for ( ; ; ) { - int err = SSL_do_handshake(ssl->ssl); + ERR_clear_error(); + err = SSL_do_handshake(ssl->ssl); ssl->error = SSL_get_error(ssl->ssl, err); switch(ssl->error) { case SSL_ERROR_NONE: @@ -104,12 +106,14 @@ static int handshake(p_ssl ssl) static int ssl_send(void *ctx, const char *data, size_t count, size_t *sent, p_timeout tm) { + int err; p_ssl ssl = (p_ssl) ctx; if (ssl->state == ST_SSL_CLOSED) return IO_CLOSED; *sent = 0; for ( ; ; ) { - int err = SSL_write(ssl->ssl, data, (int) count); + ERR_clear_error(); + err = SSL_write(ssl->ssl, data, (int) count); ssl->error = SSL_get_error(ssl->ssl, err); switch(ssl->error) { case SSL_ERROR_NONE: @@ -146,12 +150,14 @@ static int ssl_send(void *ctx, const char *data, size_t count, size_t *sent, static int ssl_recv(void *ctx, char *data, size_t count, size_t *got, p_timeout tm) { + int err; p_ssl ssl = (p_ssl) ctx; if (ssl->state == ST_SSL_CLOSED) return IO_CLOSED; *got = 0; for ( ; ; ) { - int err = SSL_read(ssl->ssl, data, (int) count); + ERR_clear_error(); + err = SSL_read(ssl->ssl, data, (int) count); ssl->error = SSL_get_error(ssl->ssl, err); switch(ssl->error) { case SSL_ERROR_NONE: diff --git a/src/ssl.h b/src/ssl.h index 9d8f219..63b2eb7 100644 --- a/src/ssl.h +++ b/src/ssl.h @@ -2,7 +2,7 @@ #define __SSL_H__ /*-------------------------------------------------------------------------- - * LuaSec 0.3.2 + * LuaSec 0.3.3 * Copyright (C) 2006-2009 Bruno Silvestre * *--------------------------------------------------------------------------*/ diff --git a/src/ssl.lua b/src/ssl.lua index 9a43d02..7ba345a 100644 --- a/src/ssl.lua +++ b/src/ssl.lua @@ -1,6 +1,6 @@ ------------------------------------------------------------------------------ --- LuaSec 0.3.2 --- Copyright (C) 2006-2008 Bruno Silvestre +-- LuaSec 0.3.3 +-- Copyright (C) 2006-2009 Bruno Silvestre -- ------------------------------------------------------------------------------ @@ -10,8 +10,8 @@ require("ssl.core") require("ssl.context") -_VERSION = "0.3.2" -_COPYRIGHT = "LuaSec 0.3.2 - Copyright (C) 2006-2009 Bruno Silvestre\n" .. +_VERSION = "0.3.3" +_COPYRIGHT = "LuaSec 0.3.3 - Copyright (C) 2006-2009 Bruno Silvestre\n" .. "LuaSocket 2.0.2 - Copyright (C) 2004-2007 Diego Nehab" -- Export functions