New package: luasec-0.5

This commit is contained in:
Duncaen 2015-03-22 23:01:06 +01:00
parent 041b9aa4fe
commit eabd582438
3 changed files with 207 additions and 0 deletions

View File

@ -0,0 +1,36 @@
diff --git src/ssl.c src/ssl.c
index 2fa6ede..bd8a744 100644
--- src/ssl.c
+++ src/ssl.c
@@ -395,24 +395,30 @@ static int meth_want(lua_State *L)
}
return 1;
}
-
+
/**
* Return the compression method used.
*/
static int meth_compression(lua_State *L)
{
+#if !defined(OPENSSL_NO_COMP)
const COMP_METHOD *comp;
+#endif
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
if (ssl->state != LSEC_STATE_CONNECTED) {
lua_pushnil(L);
lua_pushstring(L, "closed");
return 2;
}
+#if !defined(OPENSSL_NO_COMP)
comp = SSL_get_current_compression(ssl->ssl);
if (comp)
lua_pushstring(L, SSL_COMP_get_name(comp));
else
lua_pushnil(L);
+#else
+ lua_pushnil(L);
+#endif
return 1;
}

View File

@ -0,0 +1,153 @@
diff --git src/context.c src/context.c
index cafc222..107ed60 100644
--- src/context.c
+++ src/context.c
@@ -18,8 +18,8 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-#include <lua.h>
-#include <lauxlib.h>
+#include "lua5.1/lua.h"
+#include "lua5.1/lauxlib.h"
#include "context.h"
#include "options.h"
diff --git src/context.h src/context.h
index 293f615..e346096 100644
--- src/context.h
+++ src/context.h
@@ -7,7 +7,7 @@
*
*--------------------------------------------------------------------------*/
-#include <lua.h>
+#include "lua5.1/lua.h"
#include <openssl/ssl.h>
#include "config.h"
diff --git src/luasocket/buffer.c src/luasocket/buffer.c
index 4ef4e8e..5886207 100644
--- src/luasocket/buffer.c
+++ src/luasocket/buffer.c
@@ -2,8 +2,8 @@
* Input/Output interface for Lua programs
* LuaSocket toolkit
\*=========================================================================*/
-#include "lua.h"
-#include "lauxlib.h"
+#include "lua5.1/lua.h"
+#include "lua5.1/lauxlib.h"
#include "buffer.h"
diff --git src/luasocket/buffer.h src/luasocket/buffer.h
index 1281bb3..cd7da2e 100644
--- src/luasocket/buffer.h
+++ src/luasocket/buffer.h
@@ -15,7 +15,7 @@
* The module is built on top of the I/O abstraction defined in io.h and the
* timeout management is done with the timeout.h interface.
\*=========================================================================*/
-#include "lua.h"
+#include "lua5.1/lua.h"
#include "io.h"
#include "timeout.h"
diff --git src/luasocket/io.h src/luasocket/io.h
index 76a3e58..fe72085 100644
--- src/luasocket/io.h
+++ src/luasocket/io.h
@@ -13,7 +13,7 @@
* is very simple.
\*=========================================================================*/
#include <stdio.h>
-#include "lua.h"
+#include "lua5.1/lua.h"
#include "timeout.h"
diff --git src/luasocket/timeout.c src/luasocket/timeout.c
index 94a524b..32edaa4 100644
--- src/luasocket/timeout.c
+++ src/luasocket/timeout.c
@@ -6,8 +6,8 @@
#include <limits.h>
#include <float.h>
-#include "lua.h"
-#include "lauxlib.h"
+#include "lua5.1/lua.h"
+#include "lua5.1/lauxlib.h"
#include "timeout.h"
diff --git src/luasocket/timeout.h src/luasocket/timeout.h
index 6715ca7..d758270 100644
--- src/luasocket/timeout.h
+++ src/luasocket/timeout.h
@@ -4,7 +4,7 @@
* Timeout management functions
* LuaSocket toolkit
\*=========================================================================*/
-#include "lua.h"
+#include "lua5.1/lua.h"
/* timeout control structure */
typedef struct t_timeout_ {
diff --git src/ssl.c src/ssl.c
index bd8a744..b26e99e 100644
--- src/ssl.c
+++ src/ssl.c
@@ -19,8 +19,8 @@
#include <openssl/x509_vfy.h>
#include <openssl/err.h>
-#include <lua.h>
-#include <lauxlib.h>
+#include "lua5.1/lua.h"
+#include "lua5.1/lauxlib.h"
#include <luasocket/io.h>
#include <luasocket/buffer.h>
diff --git src/ssl.h src/ssl.h
index b357196..1bb42fc 100644
--- src/ssl.h
+++ src/ssl.h
@@ -8,7 +8,7 @@
*--------------------------------------------------------------------------*/
#include <openssl/ssl.h>
-#include <lua.h>
+#include "lua5.1/lua.h"
#include <luasocket/io.h>
#include <luasocket/buffer.h>
diff --git src/x509.c src/x509.c
index 5e7a1dd..9865561 100644
--- src/x509.c
+++ src/x509.c
@@ -20,8 +20,8 @@
#include <openssl/bio.h>
#include <openssl/bn.h>
-#include <lua.h>
-#include <lauxlib.h>
+#include "lua5.1/lua.h"
+#include "lua5.1/lauxlib.h"
#include "x509.h"
diff --git src/x509.h src/x509.h
index 2b32cdd..9c52f12 100644
--- src/x509.h
+++ src/x509.h
@@ -10,7 +10,7 @@
#define LSEC_X509_H
#include <openssl/x509v3.h>
-#include <lua.h>
+#include "lua5.1/lua.h"
#include "config.h"

18
srcpkgs/luasec/template Normal file
View File

@ -0,0 +1,18 @@
# Template file for 'luasec'
pkgname=luasec
version=0.5
revision=1
wrksrc=${pkgname}-${pkgname}-${version}
build_style=gnu-makefile
makedepends="lua51-devel libressl-devel"
depends="lua51"
short_desc="Lua binding for OpenSSL library to provide TLS/SSL communication"
maintainer="Duncaen <mail@duncano.de>"
license="MIT"
homepage="https://github.com/brunoos/luasec"
distfiles="https://github.com/brunoos/luasec/archive/${pkgname}-${version}.tar.gz"
checksum=6480598f7492ac479b6b608b5fb1488226bfa6ef675e29f6b24dbe9099083523
do_build() {
make linux CC=$CC LD=$CC INC_PATH=-I${XBPS_CROSS_BASE}/usr/include LIB_PATH=-L${XBPS_CROSS_BASE}/usr/lib
}