aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-10-07 16:52:18 +0200
committerKim Alvefur <zash@zash.se>2016-10-07 16:52:18 +0200
commit67c41ef89e175c064eca7d7518779aefed31c187 (patch)
tree9043fbad3e9e1ac74e957347fedc8cca0a635106
parent5ebf40bbffcbd1b50d76228307ade67863c3f586 (diff)
parent36b9149295afd0c8b48e91c82ef0a1f8ebe7f932 (diff)
downloadprosody-67c41ef89e175c064eca7d7518779aefed31c187.tar.gz
prosody-67c41ef89e175c064eca7d7518779aefed31c187.zip
Merge 0.10->trunk
-rw-r--r--Makefile53
-rw-r--r--plugins/mod_carbons.lua4
-rw-r--r--plugins/mod_s2s/mod_s2s.lua2
-rw-r--r--plugins/mod_s2s/s2sout.lib.lua4
-rw-r--r--plugins/muc/muc.lib.lua1
-rw-r--r--util/datamanager.lua34
-rw-r--r--util/jid.lua2
7 files changed, 58 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index 06e67c9c..67730b9f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,12 @@ INSTALLEDCONFIG = $(SYSCONFDIR)
INSTALLEDMODULES = $(LIBDIR)/prosody/modules
INSTALLEDDATA = $(DATADIR)
+INSTALL=install -p
+INSTALL_DATA=$(INSTALL) -m644
+INSTALL_EXEC=$(INSTALL) -m755
+MKDIR=install -d
+MKDIR_PRIVATE=$(MKDIR) -m750
+
.PHONY: all clean install
all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version
@@ -22,27 +28,32 @@ ifeq ($(EXCERTS),yes)
endif
install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so
- install -d $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
- install -m750 -d $(DATA)
- install -d $(MAN)/man1
- install -d $(CONFIG)/certs
- install -d $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
- install -m755 ./prosody.install $(BIN)/prosody
- install -m755 ./prosodyctl.install $(BIN)/prosodyctl
- install -m644 core/*.lua $(SOURCE)/core
- install -m644 net/*.lua $(SOURCE)/net
- install -d $(SOURCE)/net/http $(SOURCE)/net/websocket
- install -m644 net/http/*.lua $(SOURCE)/net/http
- install -m644 net/websocket/*.lua $(SOURCE)/net/websocket
- install -m644 util/*.lua $(SOURCE)/util
- install -m644 util/*.so $(SOURCE)/util
- install -d $(SOURCE)/util/sasl
- install -m644 util/sasl/* $(SOURCE)/util/sasl
- umask 0022 && cp -r plugins/* $(MODULES)
- 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
+ $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE)
+ $(MKDIR_PRIVATE) $(DATA)
+ $(MKDIR) $(MAN)/man1
+ $(MKDIR) $(CONFIG)/certs
+ $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util
+ $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody
+ $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl
+ $(INSTALL_DATA) core/*.lua $(SOURCE)/core
+ $(INSTALL_DATA) net/*.lua $(SOURCE)/net
+ $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/websocket
+ $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http
+ $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket
+ $(INSTALL_DATA) util/*.lua $(SOURCE)/util
+ $(INSTALL_DATA) util/*.so $(SOURCE)/util
+ $(MKDIR) $(SOURCE)/util/sasl
+ $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl
+ $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc
+ $(INSTALL_DATA) plugins/*.lua $(MODULES)
+ $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)
+ $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)
+ $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)
+ $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)
+ $(INSTALL_DATA) certs/* $(CONFIG)/certs
+ $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1
+ test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua
+ -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version
$(MAKE) install -C util-src
clean:
diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua
index 9ef14713..951645f8 100644
--- a/plugins/mod_carbons.lua
+++ b/plugins/mod_carbons.lua
@@ -1,5 +1,5 @@
-- XEP-0280: Message Carbons implementation for Prosody
--- Copyright (C) 2011 Kim Alvefur
+-- Copyright (C) 2011-2016 Kim Alvefur
--
-- This file is MIT/X11 licensed.
@@ -67,7 +67,7 @@ local function message_handler(event, c2s)
elseif stanza:get_child("no-copy", "urn:xmpp:hints") then
module:log("debug", "Message has no-copy hint, ignoring");
return
- elseif stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
+ elseif not c2s and bare_jid == orig_from and stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
module:log("debug", "MUC PM, ignoring");
return
end
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index c9b6b137..00e816f7 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -389,7 +389,7 @@ function stream_callbacks._streamopened(session, attr)
elseif session.direction == "outgoing" then
session.notopen = nil;
if not attr.id then
- log("error", "Stream response from %s did not give us a stream id!", session.to_host);
+ log("warn", "Stream response did not give us a stream id!");
session:close({ condition = "undefined-condition", text = "Missing stream ID" });
return;
end
diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua
index 1038a616..61d6086e 100644
--- a/plugins/mod_s2s/s2sout.lib.lua
+++ b/plugins/mod_s2s/s2sout.lib.lua
@@ -176,6 +176,8 @@ function s2sout.try_connect(host_session, connect_host, connect_port, err)
log("debug", "DNS reply for %s gives us %s", connect_host, ip.a);
IPs[#IPs+1] = new_ip(ip.a, "IPv4");
end
+ elseif err then
+ log("debug", "Error in DNS lookup: %s", err);
end
if have_other_result then
@@ -212,6 +214,8 @@ function s2sout.try_connect(host_session, connect_host, connect_port, err)
log("debug", "DNS reply for %s gives us %s", connect_host, ip.aaaa);
IPs[#IPs+1] = new_ip(ip.aaaa, "IPv6");
end
+ elseif err then
+ log("debug", "Error in DNS lookup: %s", err);
end
if have_other_result then
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 4ad75476..0d6e4094 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -812,6 +812,7 @@ function room_mt:destroy(newjid, reason, password)
x:up();
self:clear(x);
module:fire_event("muc-room-destroyed", { room = self });
+ return true;
end
function room_mt:handle_disco_info_get_query(origin, stanza)
diff --git a/util/datamanager.lua b/util/datamanager.lua
index fb9ba3a4..2884b942 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -122,15 +122,15 @@ local function getpath(username, host, datastore, ext, create)
end
local function load(username, host, datastore)
- local data, ret = envloadfile(getpath(username, host, datastore), {});
+ local data, err = envloadfile(getpath(username, host, datastore), {});
if not data then
local mode = lfs.attributes(getpath(username, host, datastore), "mode");
if not mode then
- log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+ log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
return nil;
else -- file exists, but can't be read
-- TODO more detailed error checking and logging?
- log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+ log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
return nil, "Error reading storage";
end
end
@@ -295,15 +295,15 @@ end
local function list_load(username, host, datastore)
local items = {};
- local data, ret = envloadfile(getpath(username, host, datastore, "list"), {item = function(i) t_insert(items, i); end});
+ local data, err = envloadfile(getpath(username, host, datastore, "list"), {item = function(i) t_insert(items, i); end});
if not data then
local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
if not mode then
- log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+ log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
return nil;
else -- file exists, but can't be read
-- TODO more detailed error checking and logging?
- log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, ret, username or "nil", host or "nil");
+ log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
return nil, "Error reading storage";
end
end
@@ -321,7 +321,7 @@ local type_map = {
list = "list";
}
-local function users(host, store, typ)
+local function users(host, store, typ) -- luacheck: ignore 431/store
typ = type_map[typ or "keyval"];
local store_dir = format("%s/%s/%s", data_path, encode(host), store);
@@ -329,8 +329,8 @@ local function users(host, store, typ)
if not mode then
return function() log("debug", "%s", err or (store_dir .. " does not exist")) end
end
- local next, state = lfs.dir(store_dir);
- return function(state)
+ local next, state = lfs.dir(store_dir); -- luacheck: ignore 431/next 431/state
+ return function(state) -- luacheck: ignore 431/state
for node in next, state do
local file, ext = node:match("^(.*)%.([dalist]+)$");
if file and ext == typ then
@@ -348,8 +348,8 @@ local function stores(username, host, typ)
if not mode then
return function() log("debug", err or (store_dir .. " does not exist")) end
end
- local next, state = lfs.dir(store_dir);
- return function(state)
+ local next, state = lfs.dir(store_dir); -- luacheck: ignore 431/next 431/state
+ return function(state) -- luacheck: ignore 431/state
for node in next, state do
if not node:match"^%." then
if username == true then
@@ -357,9 +357,9 @@ local function stores(username, host, typ)
return decode(node);
end
elseif username then
- local store = decode(node)
- if lfs.attributes(getpath(username, host, store, typ), "mode") then
- return store;
+ local store_name = decode(node);
+ if lfs.attributes(getpath(username, host, store_name, typ), "mode") then
+ return store_name;
end
elseif lfs.attributes(node, "mode") == "file" then
local file, ext = node:match("^(.*)%.([dalist]+)$");
@@ -389,11 +389,11 @@ local function purge(username, host)
local errs = {};
for file in iter, state, var do
if lfs.attributes(host_dir..file, "mode") == "directory" then
- local store = decode(file);
- local ok, err = do_remove(getpath(username, host, store));
+ local store_name = decode(file);
+ local ok, err = do_remove(getpath(username, host, store_name));
if not ok then errs[#errs+1] = err; end
- local ok, err = do_remove(getpath(username, host, store, "list"));
+ local ok, err = do_remove(getpath(username, host, store_name, "list"));
if not ok then errs[#errs+1] = err; end
end
end
diff --git a/util/jid.lua b/util/jid.lua
index 522fb126..f402b7f4 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -46,7 +46,7 @@ end
local function prepped_split(jid)
local node, host, resource = split(jid);
- if host then
+ if host and host ~= "." then
if sub(host, -1, -1) == "." then -- Strip empty root label
host = sub(host, 1, -2);
end