From: Jo-Philipp Wich Date: Sat, 27 Mar 2010 19:17:47 +0000 (+0000) Subject: luci-0.9: merge r5954 X-Git-Tag: 0.9.0~24 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7ff62d42c503e5741a76024861ad4951a36d0b48;p=oweals%2Fluci.git luci-0.9: merge r5954 --- diff --git a/libs/nixio/Makefile b/libs/nixio/Makefile index f70f75421..a8a57b3a2 100644 --- a/libs/nixio/Makefile +++ b/libs/nixio/Makefile @@ -16,7 +16,7 @@ NIXIO_SO = nixio.so NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \ src/poll.o src/io.o src/file.o src/splice.o src/process.o src/syslog.o \ src/bit.o src/binary.o src/fs.o src/user.o \ - src/tls-crypto.o src/tls-context.o src/tls-socket.o + $(if $(NIXIO_TLS),src/tls-crypto.o src/tls-context.o src/tls-socket.o,) ifeq ($(NIXIO_TLS),axtls) TLS_CFLAGS = -IaxTLS/ssl -IaxTLS/crypto -IaxTLS/config -include src/axtls-compat.h @@ -35,6 +35,10 @@ ifeq ($(NIXIO_TLS),cyassl) NIXIO_OBJ += src/cyassl-compat.o endif +ifeq ($(NIXIO_TLS),) + NIXIO_CFLAGS += -DNO_TLS +endif + ifeq ($(OS),SunOS) NIXIO_LDFLAGS += -lsocket -lnsl -lsendfile @@ -58,6 +62,7 @@ endif %.o: %.c $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $< +ifneq ($(NIXIO_TLS),) src/tls-crypto.o: $(TLS_DEPENDS) src/tls-crypto.c $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/tls-crypto.c @@ -71,7 +76,7 @@ src/axtls-compat.o: src/libaxtls.a src/axtls-compat.c $(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) $(TLS_CFLAGS) -c -o $@ src/axtls-compat.c mkdir -p dist cp -pR axtls-root/* dist/ - +endif compile: $(NIXIO_OBJ) $(LINK) $(SHLIB_FLAGS) $(NIXIO_LDFLAGS) -o src/$(NIXIO_SO) $(NIXIO_OBJ) $(NIXIO_LDFLAGS_POST) diff --git a/libs/nixio/lua/nixio/util.lua b/libs/nixio/lua/nixio/util.lua index 409004882..63d2f6214 100644 --- a/libs/nixio/lua/nixio/util.lua +++ b/libs/nixio/lua/nixio/util.lua @@ -237,30 +237,34 @@ function meta.copyz(self, fd, size) return self:copy(fd, size) end -function tls_socket.close(self) - return self.socket:close() -end +if tls_socket then + function tls_socket.close(self) + return self.socket:close() + end -function tls_socket.getsockname(self) - return self.socket:getsockname() -end + function tls_socket.getsockname(self) + return self.socket:getsockname() + end -function tls_socket.getpeername(self) - return self.socket:getpeername() -end + function tls_socket.getpeername(self) + return self.socket:getpeername() + end -function tls_socket.getsockopt(self, ...) - return self.socket:getsockopt(...) -end -tls_socket.getopt = tls_socket.getsockopt + function tls_socket.getsockopt(self, ...) + return self.socket:getsockopt(...) + end + tls_socket.getopt = tls_socket.getsockopt -function tls_socket.setsockopt(self, ...) - return self.socket:setsockopt(...) + function tls_socket.setsockopt(self, ...) + return self.socket:setsockopt(...) + end + tls_socket.setopt = tls_socket.setsockopt end -tls_socket.setopt = tls_socket.setsockopt for k, v in pairs(meta) do file[k] = v socket[k] = v - tls_socket[k] = v + if tls_socket then + tls_socket[k] = v + end end diff --git a/libs/nixio/src/nixio.c b/libs/nixio/src/nixio.c index 3086b978b..f6e8e184c 100644 --- a/libs/nixio/src/nixio.c +++ b/libs/nixio/src/nixio.c @@ -142,9 +142,12 @@ NIXIO_API int luaopen_nixio(lua_State *L) { nixio_open_bin(L); nixio_open_fs(L); nixio_open_user(L); + +#ifndef NO_TLS nixio_open_tls_crypto(L); nixio_open_tls_context(L); nixio_open_tls_socket(L); +#endif /* module version */ lua_pushinteger(L, VERSION); diff --git a/libs/nixio/src/nixio.h b/libs/nixio/src/nixio.h index ff75cfd98..2be197f13 100644 --- a/libs/nixio/src/nixio.h +++ b/libs/nixio/src/nixio.h @@ -120,9 +120,12 @@ void nixio_open_bit(lua_State *L); void nixio_open_bin(lua_State *L); void nixio_open_fs(lua_State *L); void nixio_open_user(lua_State *L); + +#ifndef NO_TLS void nixio_open_tls_crypto(lua_State *L); void nixio_open_tls_context(lua_State *L); void nixio_open_tls_socket(lua_State *L); +#endif /* Method functions */