aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-01-12 06:27:55 -0500
committerMatthew Wild <mwild1@gmail.com>2014-01-12 06:27:55 -0500
commitf240b6bd4dcc33c040ca3913ce54d3d31c4dbf1b (patch)
tree961993cab2a02c20c789b381d93a74a8d74164fe
parent667f75150d48db1815d8566228a41e9290fe163e (diff)
parent6a177d7ad6517cd53943c4e03d2bac578d251108 (diff)
downloadprosody-f240b6bd4dcc33c040ca3913ce54d3d31c4dbf1b.tar.gz
prosody-f240b6bd4dcc33c040ca3913ce54d3d31c4dbf1b.zip
Merge 0.10->trunk
-rw-r--r--plugins/mod_s2s/mod_s2s.lua8
-rw-r--r--plugins/mod_storage_sql2.lua4
-rw-r--r--tools/migration/migrator/prosody_files.lua12
3 files changed, 14 insertions, 10 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 5afb958c..5531ca3e 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -366,7 +366,7 @@ function stream_callbacks.streamopened(session, attr)
if to then
hosts[to].events.fire_event("s2s-stream-features", { origin = session, features = features });
else
- (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or "unknown host");
+ (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host");
end
log("debug", "Sending stream features: %s", tostring(features));
@@ -467,7 +467,7 @@ local function session_close(session, reason, remote_reason)
end
if reason then -- nil == no err, initiated by us, false == initiated by remote
if type(reason) == "string" then -- assume stream error
- log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or "(unknown host)", session.type, reason);
+ log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or session.ip or "(unknown host)", session.type, reason);
session.sends2s(st.stanza("stream:error"):tag(reason, {xmlns = 'urn:ietf:params:xml:ns:xmpp-streams' }));
elseif type(reason) == "table" then
if reason.condition then
@@ -478,7 +478,7 @@ local function session_close(session, reason, remote_reason)
if reason.extra then
stanza:add_child(reason.extra);
end
- log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or "(unknown host)", session.type, tostring(stanza));
+ log("debug", "Disconnecting %s[%s], <stream:error> is: %s", session.host or session.ip or "(unknown host)", session.type, tostring(stanza));
session.sends2s(stanza);
elseif reason.name then -- a stanza
log("debug", "Disconnecting %s->%s[%s], <stream:error> is: %s", session.from_host or "(unknown host)", session.to_host or "(unknown host)", session.type, tostring(reason));
@@ -660,7 +660,7 @@ function check_auth_policy(event)
end
if must_secure and (session.cert_chain_status ~= "valid" or session.cert_identity_status ~= "valid") then
- module:log("warn", "Forbidding insecure connection to/from %s", host);
+ module:log("warn", "Forbidding insecure connection to/from %s", host or session.ip or "(unknown host)");
if session.direction == "incoming" then
session:close({ condition = "not-authorized", text = "Your server's certificate is invalid, expired, or not trusted by "..session.to_host });
else -- Close outgoing connections without warning
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua
index a97bee58..8c8728da 100644
--- a/plugins/mod_storage_sql2.lua
+++ b/plugins/mod_storage_sql2.lua
@@ -263,12 +263,12 @@ local function archive_where_id_range(query, args, where)
local args_len = #args
-- Before or after specific item, exclusive
if query.after then -- keys better be unique!
- where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)"
+ where[#where+1] = "`sort_id` > (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?` AND user` = ?` AND store` = ? LIMIT 1)"
args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.after, args[1], args[2], args[3];
args_len = args_len + 4
end
if query.before then
- where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?`AND user` = ?`AND store` = ? LIMIT 1)"
+ where[#where+1] = "`sort_id` < (SELECT `sort_id` FROM `prosodyarchive` WHERE `key` = ? AND `host` = ?` AND user` = ?` AND store` = ? LIMIT 1)"
args[args_len+1], args[args_len+2], args[args_len+3], args[args_len+4] = query.before, args[1], args[2], args[3];
end
end
diff --git a/tools/migration/migrator/prosody_files.lua b/tools/migration/migrator/prosody_files.lua
index 4462fb3e..c9367d9c 100644
--- a/tools/migration/migrator/prosody_files.lua
+++ b/tools/migration/migrator/prosody_files.lua
@@ -13,6 +13,7 @@ local next = next;
local pairs = pairs;
local json = require "util.json";
local os_getenv = os.getenv;
+local error = error;
prosody = {};
local dm = require "util.datamanager"
@@ -95,15 +96,18 @@ function reader(input)
local iter = mtools.sorted {
reader = function()
local x = iter();
- if x then
+ while x do
dm.set_data_path(path);
local err;
x.data, err = dm.load(x.user, x.host, x.store);
if x.data == nil and err then
- error(("Error loading data at path %s for %s@%s (%s store)")
- :format(path, x.user or "<nil>", x.host or "<nil>", x.store or "<nil>"), 0);
+ local p = dm.getpath(x.user, x.host, x.store);
+ print(("Error loading data at path %s for %s@%s (%s store): %s")
+ :format(p, x.user or "<nil>", x.host or "<nil>", x.store or "<nil>", err or "<nil>"));
+ else
+ return x;
end
- return x;
+ x = iter();
end
end;
sorter = function(a, b)