diff options
author | Kim Alvefur <zash@zash.se> | 2015-09-27 00:37:18 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2015-09-27 00:37:18 +0200 |
commit | 0e4e770687183e78e70ea16d056c039062b3708f (patch) | |
tree | 2e6a296aac1eb2dbf8f40a56235d32870b270b99 | |
parent | e8cb3e473a07e28039c0b41ab1ee83db524364f5 (diff) | |
parent | b9c17069eac26443575ceee3674a12cb41df4f52 (diff) | |
download | prosody-0e4e770687183e78e70ea16d056c039062b3708f.tar.gz prosody-0e4e770687183e78e70ea16d056c039062b3708f.zip |
Merge 0.10->trunk
-rw-r--r-- | Makefile | 22 | ||||
-rwxr-xr-x | configure | 5 | ||||
-rw-r--r-- | plugins/mod_http_files.lua | 4 | ||||
-rw-r--r-- | plugins/mod_posix.lua | 44 | ||||
-rw-r--r-- | util-src/Makefile | 42 |
5 files changed, 57 insertions, 60 deletions
@@ -18,7 +18,7 @@ INSTALLEDDATA = $(DATADIR) 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: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodin 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 @@ util/%.so: 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 > $@ + + @@ -112,6 +112,7 @@ do 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 @@ then 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 @@ LUA_BINDIR=$LUA_BINDIR 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 diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index 2e9f4182..7c503c82 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -61,8 +61,8 @@ function serve(opts) 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 diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index c9b9f3aa..7e6d8799 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -14,8 +14,8 @@ if pposix._VERSION ~= want_pposix_version then 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 @@ pposix.umask(umask); -- 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 @@ end 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(); diff --git a/util-src/Makefile b/util-src/Makefile index 3674975c..5f35b81b 100644 --- a/util-src/Makefile +++ b/util-src/Makefile @@ -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 - -encodings.so: encodings.o - MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; - $(CC) -o $@ $< $(LDFLAGS) $(IDNA_LIBS) - -hashes.so: hashes.o - MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; - $(CC) -o $@ $< $(LDFLAGS) -l$(OPENSSL_LIB) + rm -f $(ALL) -.c.o: - $(CC) $(CFLAGS) -I$(LUA_INCDIR) -c -o $@ $< +encodings.so: LDLIBS+=$(IDNA_LIBS) -.o.so: - MACOSX_DEPLOYMENT_TARGET="10.3"; export MACOSX_DEPLOYMENT_TARGET; - $(LD) -o $@ $< $(LDFLAGS) +hashes.so: LDLIBS+=$(OPENSSL_LIBS) +%.so: %.o + $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS) |