Changeset

6888:39c5c49616ab

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 27 Sep 2015 00:37:18 +0200
parents 6871:e4b5885b7712 (current diff) 6887:da38775bda82 (diff)
children 6890:47cd0b4b5544
files
diffstat 5 files changed, 57 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Sep 25 18:11:45 2015 +0200
+++ b/Makefile	Sun Sep 27 00:37:18 2015 +0200
@@ -18,7 +18,7 @@
 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
 	$(MAKE) -C util-src install
 ifeq ($(EXCERTS),yes)
-	$(MAKE) -C certs localhost.crt example.com.crt || true
+	-$(MAKE) -C certs localhost.crt example.com.crt
 endif
 
 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
@@ -42,7 +42,7 @@
 	install -m644 certs/* $(CONFIG)/certs
 	install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1
 	test -f $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
-	test -f prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version || true
+	-test -f prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version
 	$(MAKE) install -C util-src
 
 clean:
@@ -65,8 +65,16 @@
 prosody.cfg.lua.install: prosody.cfg.lua.dist
 	sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@
 
-prosody.version: $(wildcard prosody.release .hg/dirstate)
-	test -f .hg/dirstate && \
-		hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || true
-	test -f prosody.release && \
-		cp prosody.release $@ || true
+%.version: %.release
+	cp $^ $@
+
+%.version: .hg_archival.txt
+	sed -n 's/^node: \(............\).*/\1/p' $^ > $@
+
+%.version: .hg/dirstate
+	hexdump -n6 -e'6/1 "%02x"' $^ > $@
+
+%.version:
+	echo unknown > $@
+
+
--- a/configure	Fri Sep 25 18:11:45 2015 +0200
+++ b/configure	Sun Sep 27 00:37:18 2015 +0200
@@ -112,6 +112,7 @@
       	LUA_INCDIR_SET=yes
       	LUA_LIBDIR=/usr/local/lib
       	LUA_LIBDIR_SET=yes
+      	CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
       	LDFLAGS="-bundle -undefined dynamic_lookup"
     	fi
       if [ "$OSTYPE" = "linux" ]; then
@@ -309,6 +310,8 @@
 	IDNA_LIBS="-l$IDN_LIB"
 fi
 
+OPENSSL_LIBS="-l$OPENSSL_LIB"
+
 echo -n "Checking Lua includes... "
 lua_h="$LUA_INCDIR/lua.h"
 if [ -f "$lua_h" ]
@@ -361,7 +364,7 @@
 REQUIRE_CONFIG=$REQUIRE_CONFIG
 IDN_LIB=$IDN_LIB
 IDNA_LIBS=$IDNA_LIBS
-OPENSSL_LIB=$OPENSSL_LIB
+OPENSSL_LIBS=$OPENSSL_LIBS
 CFLAGS=$CFLAGS
 LDFLAGS=$LDFLAGS
 CC=$CC
--- a/plugins/mod_http_files.lua	Fri Sep 25 18:11:45 2015 +0200
+++ b/plugins/mod_http_files.lua	Sun Sep 27 00:37:18 2015 +0200
@@ -61,8 +61,8 @@
 	local function serve_file(event, path)
 		local request, response = event.request, event.response;
 		local orig_path = request.path;
-		local full_path = base_path .. (path and "/"..path or "");
-		local attr = stat((full_path:gsub('%'..path_sep..'+$','')));
+		local full_path = base_path .. (path and "/"..path or ""):gsub("/", path_sep);
+		local attr = stat(full_path:match("^.*[^\\/]")); -- Strip trailing path separator because Windows
 		if not attr then
 			return 404;
 		end
--- a/plugins/mod_posix.lua	Fri Sep 25 18:11:45 2015 +0200
+++ b/plugins/mod_posix.lua	Sun Sep 27 00:37:18 2015 +0200
@@ -14,8 +14,8 @@
 	module:log("warn", "Unknown version (%s) of binary pposix module, expected %s. Perhaps you need to recompile?", tostring(pposix._VERSION), want_pposix_version);
 end
 
-local signal = select(2, pcall(require, "util.signal"));
-if type(signal) == "string" then
+local have_signal, signal = pcall(require, "util.signal");
+if not have_signal then
 	module:log("warn", "Couldn't load signal library, won't respond to SIGTERM");
 end
 
@@ -31,27 +31,27 @@
 
 -- Allow switching away from root, some people like strange ports.
 module:hook("server-started", function ()
-		local uid = module:get_option("setuid");
-		local gid = module:get_option("setgid");
-		if gid then
-			local success, msg = pposix.setgid(gid);
-			if success then
-				module:log("debug", "Changed group to %s successfully.", gid);
-			else
-				module:log("error", "Failed to change group to %s. Error: %s", gid, msg);
-				prosody.shutdown("Failed to change group to %s", gid);
-			end
+	local uid = module:get_option("setuid");
+	local gid = module:get_option("setgid");
+	if gid then
+		local success, msg = pposix.setgid(gid);
+		if success then
+			module:log("debug", "Changed group to %s successfully.", gid);
+		else
+			module:log("error", "Failed to change group to %s. Error: %s", gid, msg);
+			prosody.shutdown("Failed to change group to %s", gid);
 		end
-		if uid then
-			local success, msg = pposix.setuid(uid);
-			if success then
-				module:log("debug", "Changed user to %s successfully.", uid);
-			else
-				module:log("error", "Failed to change user to %s. Error: %s", uid, msg);
-				prosody.shutdown("Failed to change user to %s", uid);
-			end
+	end
+	if uid then
+		local success, msg = pposix.setuid(uid);
+		if success then
+			module:log("debug", "Changed user to %s successfully.", uid);
+		else
+			module:log("error", "Failed to change user to %s. Error: %s", uid, msg);
+			prosody.shutdown("Failed to change user to %s", uid);
 		end
-	end);
+	end
+end);
 
 -- Don't even think about it!
 if not prosody.start_time then -- server-starting
@@ -162,7 +162,7 @@
 module:hook("server-stopped", remove_pidfile);
 
 -- Set signal handlers
-if signal.signal then
+if have_signal then
 	signal.signal("SIGTERM", function ()
 		module:log("warn", "Received SIGTERM");
 		prosody.unlock_globals();
--- a/util-src/Makefile	Fri Sep 25 18:11:45 2015 +0200
+++ b/util-src/Makefile	Sun Sep 27 00:37:18 2015 +0200
@@ -1,41 +1,27 @@
 
 include ../config.unix
 
-LUA_SUFFIX?=5.1
-LUA_INCDIR?=/usr/include/lua$(LUA_SUFFIX)
-LUA_LIB?=lua$(LUA_SUFFIX)
-IDN_LIB?=idn
-OPENSSL_LIB?=crypto
-CC?=gcc
-CXX?=g++
-LD?=gcc
-CFLAGS+=-ggdb
+CFLAGS+=-ggdb -I$(LUA_INCDIR)
+
+INSTALL_DATA=install -m644
+TARGET?=../util/
+
+ALL=encodings.so hashes.so net.so pposix.so signal.so table.so
 
 .PHONY: all install clean
 .SUFFIXES: .c .o .so
 
-all: encodings.so hashes.so net.so pposix.so signal.so table.so
+all: $(ALL)
 
-install: encodings.so hashes.so net.so pposix.so signal.so table.so
-	install *.so ../util/
+install: $(ALL)
+	$(INSTALL_DATA) $^ $(TARGET)
 
 clean:
-	rm -f *.o
-	rm -f *.so
-	rm -f ../util/*.so
+	rm -f $(ALL)
 
-encodings.so: encodings.o
-	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET;
-	$(CC) -o $@ $< $(LDFLAGS) $(IDNA_LIBS)
+encodings.so: LDLIBS+=$(IDNA_LIBS)
 
-hashes.so: hashes.o
-	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET;
-	$(CC) -o $@ $< $(LDFLAGS) -l$(OPENSSL_LIB)
+hashes.so: LDLIBS+=$(OPENSSL_LIBS)
 
-.c.o:
-	$(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o $@ $<
-
-.o.so:
-	MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET;
-	$(LD) -o $@ $< $(LDFLAGS)
-
+%.so: %.o
+	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)