aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-03 13:53:21 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-03 13:53:21 +0100
commit1213909d149d2ae2d697d6694ee1a30ef41c47f4 (patch)
treebf22e9f39d9ccaa98ba9f214cfa01d7c3408d46a
parentc8e37d89fdf5c9b5990cd309d53707f990986559 (diff)
parent64579702abbbb36676a94a86d88cc54c119f4433 (diff)
downloadprosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.tar.gz
prosody-1213909d149d2ae2d697d6694ee1a30ef41c47f4.zip
Merge 0.9->trunk
-rw-r--r--AUTHORS12
-rw-r--r--DEPENDS16
-rw-r--r--INSTALL15
-rw-r--r--TODO7
-rwxr-xr-xconfigure1
-rw-r--r--core/configmanager.lua9
-rw-r--r--core/moduleapi.lua32
-rw-r--r--core/modulemanager.lua19
-rw-r--r--net/http/server.lua8
-rw-r--r--plugins/mod_groups.lua7
-rw-r--r--plugins/mod_presence.lua4
-rw-r--r--plugins/mod_pubsub.lua10
-rw-r--r--plugins/mod_s2s/mod_s2s.lua6
-rw-r--r--prosody.cfg.lua.dist41
-rw-r--r--tools/migration/Makefile3
-rw-r--r--util/helpers.lua8
-rw-r--r--util/stanza.lua6
17 files changed, 126 insertions, 78 deletions
diff --git a/AUTHORS b/AUTHORS
index 0875361d..3ead470b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,10 @@
-== Core development team ==
-Matthew Wild (matthew.wild AT heavy-horse.co.uk)
-Waqas Hussain (waqas20 AT gmail.com)
+The Prosody project is open to contributions (see HACKERS file), but is
+maintained daily by:
+
+ - Matthew Wild (mail: matthew [at] prosody.im)
+ - Waqas Hussain (mail: waqas [at] prosody.im)
+ - Kim Alvefur (mail: zash [at] prosody.im)
+
+You can reach us collectively by email: developers [at] prosody.im
+or in realtime in the Prosody chatroom: prosody@conference.prosody.im
diff --git a/DEPENDS b/DEPENDS
index e7035430..ba125904 100644
--- a/DEPENDS
+++ b/DEPENDS
@@ -1,9 +1,11 @@
-The easiest way to install dependencies is using the luarocks tool.
-Rocks:
-luaexpat
-luasocket
-luafilesystem
+For full information on our dependencies, version requirements, and
+where to find them, see http://prosody.im/doc/depends
+
+If you have luarocks available on your platform, install the following:
+
+ - luaexpat
+ - luasocket
+ - luafilesystem
+ - luasec
-Non-rocks:
-LuaSec for SSL connections
diff --git a/INSTALL b/INSTALL
index 089e3133..f0fa894d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,18 +1,18 @@
-(This file was created from
-http://prosody.im/doc/installing_from_source on 2012-05-12)
+(This file was created from
+http://prosody.im/doc/installing_from_source on 2013-03-31)
-===== Building =====
+====== Installing from source ======
==== Dependencies ====
There are a couple of libraries which Prosody needs installed before
you can build it. These are:
- * lua5.1: The interpreter
+ * lua5.1: The Lua 5.1 interpreter
* liblua5.1: Lua 5.1 library
* libssl 0.9.8: OpenSSL
* libidn11: GNU libidn library, version 1.1
-These can be installed on Debian/Ubuntu with the packages:
-lua5.1 liblua5.1-dev libidn11-dev libssl-dev
+These can be installed on Debian/Ubuntu with the packages: lua5.1
+liblua5.1-dev libidn11-dev libssl-dev
On Mandriva try: urpmi lua liblua-devel libidn-devel libopenssl-devel
@@ -33,7 +33,8 @@ accepts. You can load a preset using:
./configure --ostype=PRESET
-Where PRESET can currently be one of: debian, macosx or freebsd
+Where PRESET can currently be one of: 'debian', 'macosx' or (in 0.8
+and later) 'freebsd'
==== make ====
Once you have run configure successfully, then you can simply run:
diff --git a/TODO b/TODO
index 40e775a3..d22d20f4 100644
--- a/TODO
+++ b/TODO
@@ -1,10 +1,5 @@
-== 0.9 ==
-- IPv6
-- SASL EXTERNAL
-- Roster providers
-- Web interface
-
== 1.0 ==
+- Roster providers
- Statistics
- Clustering
- World domination
diff --git a/configure b/configure
index df62cc05..5c6439fc 100755
--- a/configure
+++ b/configure
@@ -95,6 +95,7 @@ do
if [ "$OSTYPE" = "debian" ]
then LUA_SUFFIX="5.1";
LUA_SUFFIX_SET=yes
+ RUNWITH="lua5.1"
LUA_INCDIR=/usr/include/lua5.1;
LUA_INCDIR_SET=yes
CFLAGS="$CFLAGS -D_GNU_SOURCE"
diff --git a/core/configmanager.lua b/core/configmanager.lua
index e31dbd72..9720f48a 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -7,8 +7,8 @@
--
local _G = _G;
-local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table =
- setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table;
+local setmetatable, rawget, rawset, io, error, dofile, type, pairs, table =
+ setmetatable, rawget, rawset, io, error, dofile, type, pairs, table;
local format, math_max = string.format, math.max;
local fire_event = prosody and prosody.events.fire_event or function () end;
@@ -68,7 +68,6 @@ end
-- Helper function to resolve relative paths (needed by config)
do
- local rel_path_start = ".."..path_sep;
function resolve_relative_path(parent_path, path)
if path then
-- Some normalization
@@ -152,7 +151,7 @@ end
-- Built-in Lua parser
do
local pcall, setmetatable = _G.pcall, _G.setmetatable;
- local rawget, tostring = _G.rawget, _G.tostring;
+ local rawget = _G.rawget;
parsers.lua = {};
function parsers.lua.load(data, config_file, config)
local env;
@@ -213,7 +212,7 @@ do
end
env.component = env.Component;
- function env.Include(file, wildcard)
+ function env.Include(file)
if file:match("[*?]") then
local path_pos, glob = file:match("()([^"..path_sep.."]+)$");
local path = file:sub(1, math_max(path_pos-2,0));
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index f9701471..de900bf0 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -62,6 +62,20 @@ end
function api:add_extension(data)
self:add_item("extension", data);
end
+function api:has_feature(xmlns)
+ for _, feature in ipairs(self:get_host_items("feature")) do
+ if feature == xmlns then return true; end
+ end
+ return false;
+end
+function api:has_identity(category, type, name)
+ for _, id in ipairs(self:get_host_items("identity")) do
+ if id.category == category and id.type == type and id.name == name then
+ return true;
+ end
+ end
+ return false;
+end
function api:fire_event(...)
return (hosts[self.host] or prosody).events.fire_event(...);
@@ -271,23 +285,7 @@ function api:remove_item(key, value)
end
function api:get_host_items(key)
- local result = {};
- for mod_name, module in pairs(modulemanager.get_modules(self.host)) do
- module = module.module;
- if module.items then
- for _, item in ipairs(module.items[key] or NULL) do
- t_insert(result, item);
- end
- end
- end
- for mod_name, module in pairs(modulemanager.get_modules("*")) do
- module = module.module;
- if module.items then
- for _, item in ipairs(module.items[key] or NULL) do
- t_insert(result, item);
- end
- end
- end
+ local result = modulemanager.get_items(key, self.host) or {};
return result;
end
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 35b9d0e5..535c227b 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -19,7 +19,7 @@ local prosody = prosody;
local pcall, xpcall = pcall, xpcall;
local setmetatable, rawget = setmetatable, rawget;
-local pairs, type, tostring = pairs, type, tostring;
+local ipairs, pairs, type, tostring, t_insert = ipairs, pairs, type, tostring, table.insert;
local debug_traceback = debug.traceback;
local unpack, select = unpack, select;
@@ -278,6 +278,23 @@ function get_module(host, name)
return modulemap[host] and modulemap[host][name];
end
+function get_items(key, host)
+ local result = {};
+ local modules = modulemap[host];
+ if not key or not host or not modules then return nil; end
+
+ for _, module in pairs(modules) do
+ local mod = module.module;
+ if mod.items and mod.items[key] then
+ for _, value in ipairs(mod.items[key]) do
+ t_insert(result, value);
+ end
+ end
+ end
+
+ return result;
+end
+
function get_modules(host)
return modulemap[host];
end
diff --git a/net/http/server.lua b/net/http/server.lua
index 87d82418..20c2da3e 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -219,7 +219,13 @@ function handle_request(conn, request, finish_cb)
body = result;
elseif result_type == "table" then
for k, v in pairs(result) do
- response[k] = v;
+ if k ~= "headers" then
+ response[k] = v;
+ else
+ for header_name, header_value in pairs(v) do
+ response.headers[header_name] = header_value;
+ end
+ end
end
end
response:send(body);
diff --git a/plugins/mod_groups.lua b/plugins/mod_groups.lua
index 199925f9..f7f632c2 100644
--- a/plugins/mod_groups.lua
+++ b/plugins/mod_groups.lua
@@ -13,7 +13,7 @@ local members;
local groups_file;
local jid, datamanager = require "util.jid", require "util.datamanager";
-local jid_bare, jid_prep = jid.bare, jid.prep;
+local jid_prep = jid.prep;
local module_host = module:get_host();
@@ -121,3 +121,8 @@ end
function module.unload()
datamanager.remove_callback(remove_virtual_contacts);
end
+
+-- Public for other modules to access
+function group_contains(group_name, jid)
+ return groups[group_name][jid];
+end
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index b6e3fc18..8dac2d35 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -9,7 +9,7 @@
local log = module._log;
local require = require;
-local pairs, ipairs = pairs, ipairs;
+local pairs = pairs;
local t_concat, t_insert = table.concat, table.insert;
local s_find = string.find;
local tonumber = tonumber;
@@ -346,7 +346,7 @@ module:hook("presence/full", function(data)
end);
module:hook("presence/host", function(data)
-- inbound presence to the host
- local origin, stanza = data.origin, data.stanza;
+ local stanza = data.stanza;
local from_bare = jid_bare(stanza.attr.from);
local t = stanza.attr.type;
diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua
index fe6c0b0a..5ff3a029 100644
--- a/plugins/mod_pubsub.lua
+++ b/plugins/mod_pubsub.lua
@@ -164,16 +164,6 @@ function handlers.set_subscribe(origin, stanza, subscribe)
reply = pubsub_error_reply(stanza, ret);
end
origin.send(reply);
- if ok then
- -- Send all current items
- local ok, items = service:get_items(node, stanza.attr.from);
- if items then
- local jids = { [jid] = options or true };
- for id, item in pairs(items) do
- service.config.broadcaster("items", node, jids, item);
- end
- end
- end
end
function handlers.set_unsubscribe(origin, stanza, unsubscribe)
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 6893d184..639f464b 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -632,7 +632,11 @@ function check_auth_policy(event)
if must_secure and not session.cert_identity_status then
module:log("warn", "Forbidding insecure connection to/from %s", host);
- session:close(false);
+ 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
+ session:close(false);
+ end
return false;
end
end
diff --git a/prosody.cfg.lua.dist b/prosody.cfg.lua.dist
index 9ca9608a..3c199f3e 100644
--- a/prosody.cfg.lua.dist
+++ b/prosody.cfg.lua.dist
@@ -41,6 +41,8 @@ modules_enabled = {
-- Not essential, but recommended
"private"; -- Private XML storage (for room bookmarks, etc.)
"vcard"; -- Allow users to set vCards
+
+ -- These are commented by default as they have a performance impact
--"privacy"; -- Support privacy lists
--"compression"; -- Stream compression
@@ -51,7 +53,6 @@ modules_enabled = {
"ping"; -- Replies to XMPP pings with pongs
"pep"; -- Enables users to publish their mood, activity, playing music and more
"register"; -- Allow users to register on this server using a client and change passwords
- "adhoc"; -- Support for "ad-hoc commands" that can be executed with an XMPP client
-- Admin interfaces
"admin_adhoc"; -- Allows administration via an XMPP client that supports ad-hoc commands
@@ -71,14 +72,12 @@ modules_enabled = {
--"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
};
--- These modules are auto-loaded, should you
--- (for some mad reason) want to disable
--- them then uncomment them below
+-- These modules are auto-loaded, but should you want
+-- to disable them then uncomment them here:
modules_disabled = {
- -- "presence"; -- Route user/contact status information
- -- "message"; -- Route messages
- -- "iq"; -- Route info queries
-- "offline"; -- Store offline messages
+ -- "c2s"; -- Handle client connections
+ -- "s2s"; -- Handle server-to-server connections
};
-- Disable account creation by default, for security
@@ -92,14 +91,28 @@ ssl = {
certificate = "certs/localhost.crt";
}
--- Only allow encrypted streams? Encryption is already used when
--- available. These options will cause Prosody to deny connections that
--- are not encrypted. Note that some servers do not support s2s
--- encryption or have it disabled, including gmail.com and Google Apps
--- domains.
+-- Force clients to use encrypted connections? This option will
+-- prevent clients from authenticating unless they are using encryption.
+
+c2s_require_encryption = false
+
+-- Force certificate authentication for server-to-server connections?
+-- This provides ideal security, but requires servers you communicate
+-- with to support encryption AND present valid, trusted certificates.
+-- For more information see http://prosody.im/doc/s2s#security
+
+s2s_secure = true
+
+-- Many servers don't support encryption or have invalid or self-signed
+-- certificates. You can list domains here that will not be required to
+-- authenticate using certificates. They will be authenticated using DNS.
+
+-- s2s_insecure_domains = { "gmail.com" }
+
+-- Even if you leave s2s_secure disabled, you can still require it for
+-- some domains by specifying a list here.
---c2s_require_encryption = false
---s2s_require_encryption = false
+-- s2s_secure_domains = { "jabber.org" }
-- Select the authentication backend to use. The 'internal' providers
-- use Prosody's configured data storage to store the authentication data.
diff --git a/tools/migration/Makefile b/tools/migration/Makefile
index 5998a5f7..ae402bd2 100644
--- a/tools/migration/Makefile
+++ b/tools/migration/Makefile
@@ -29,7 +29,8 @@ clean:
rm -f migrator.cfg.lua.install
prosody-migrator.install: prosody-migrator.lua
- sed "s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
+ sed "1s/\blua\b/$(RUNWITH)/; \
+ s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \
s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|;" \
< prosody-migrator.lua > prosody-migrator.install
diff --git a/util/helpers.lua b/util/helpers.lua
index 6103a319..08b86a7c 100644
--- a/util/helpers.lua
+++ b/util/helpers.lua
@@ -14,6 +14,14 @@ module("helpers", package.seeall);
local log = require "util.logger".init("util.debug");
+function log_host_events(host)
+ return log_events(prosody.hosts[host].events, host);
+end
+
+function revert_log_host_events(host)
+ return revert_log_events(prosody.hosts[host].events);
+end
+
function log_events(events, name, logger)
local f = events.fire_event;
if not f then
diff --git a/util/stanza.lua b/util/stanza.lua
index a0ab2a5a..213ed506 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -153,7 +153,7 @@ function stanza_mt:maptags(callback)
local n_children, n_tags = #self, #tags;
local i = 1;
- while curr_tag <= n_tags do
+ while curr_tag <= n_tags and n_tags > 0 do
if self[i] == tags[curr_tag] then
local ret = callback(self[i]);
if ret == nil then
@@ -161,13 +161,15 @@ function stanza_mt:maptags(callback)
t_remove(tags, curr_tag);
n_children = n_children - 1;
n_tags = n_tags - 1;
+ i = i - 1;
+ curr_tag = curr_tag - 1;
else
self[i] = ret;
tags[i] = ret;
end
- i = i + 1;
curr_tag = curr_tag + 1;
end
+ i = i + 1;
end
return self;
end