From 4f034c3b7a9640e6e2174cbfde57a6ad435f2daa Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Aug 2015 14:32:20 +0200 Subject: util.hex: Normalize hex to lowercase and discard non-hex input --- util/hex.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/hex.lua b/util/hex.lua index e41f4863..4cc28d33 100644 --- a/util/hex.lua +++ b/util/hex.lua @@ -1,6 +1,7 @@ local s_char = string.char; local s_format = string.format; local s_gsub = string.gsub; +local s_lower = string.lower; local char_to_hex = {}; local hex_to_char = {}; @@ -19,7 +20,7 @@ local function to(s) end local function from(s) - return (s_gsub(s, "..", hex_to_char)); + return (s_gsub(s_lower(s), "%X*(%x%x)%X*", hex_to_char)); end return { to = to, from = from } -- cgit v1.2.3 From 44a083cf43f17a5e49a274786c7550fdd1efce77 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Aug 2015 17:35:41 +0200 Subject: mod_carbons: Carbon chat messages or normal messages that have a body --- plugins/mod_carbons.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua index 51242809..dc5c05e0 100644 --- a/plugins/mod_carbons.lua +++ b/plugins/mod_carbons.lua @@ -21,14 +21,12 @@ module:hook("iq-set/self/"..xmlns_carbons..":enable", toggle_carbons); local function message_handler(event, c2s) local origin, stanza = event.origin, event.stanza; - local orig_type = stanza.attr.type; + local orig_type = stanza.attr.type or "normal"; local orig_from = stanza.attr.from; local orig_to = stanza.attr.to; - if not (orig_type == nil - or orig_type == "normal" - or orig_type == "chat") then - return -- No carbons for messages of type error or headline + if not(orig_type == "chat" or orig_type == "normal" and stanza:get_child("body")) then + return -- Only chat type messages end -- Stanza sent by a local client -- cgit v1.2.3 From e92f6bc9c1a8911a7385356983a21b576e19b3e0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 27 Aug 2015 12:17:12 +0200 Subject: mod_carbons: Get full_ and bare_sessions from the prosody global [luacheck] --- plugins/mod_carbons.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua index dc5c05e0..9b94d58d 100644 --- a/plugins/mod_carbons.lua +++ b/plugins/mod_carbons.lua @@ -7,7 +7,7 @@ local st = require "util.stanza"; local jid_bare = require "util.jid".bare; local xmlns_carbons = "urn:xmpp:carbons:2"; local xmlns_forward = "urn:xmpp:forward:0"; -local full_sessions, bare_sessions = full_sessions, bare_sessions; +local full_sessions, bare_sessions = prosody.full_sessions, prosody.bare_sessions; local function toggle_carbons(event) local origin, stanza = event.origin, event.stanza; -- cgit v1.2.3 From 90f5cf4cc12a0a64a92f9985cd6ea24a4198c885 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 30 Aug 2015 13:45:36 +0200 Subject: util.sql: Log when transactions begin --- util/sql.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/util/sql.lua b/util/sql.lua index 70e103df..64f7c7fc 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -180,6 +180,7 @@ function engine:_transaction(func, ...) --assert(not self.__transaction, "Recursive transactions not allowed"); local args, n_args = {...}, select("#", ...); local function f() return func(unpack(args, 1, n_args)); end + log("debug", "SQL transaction begin [%s]", tostring(func)); self.__transaction = true; local success, a, b, c = xpcall(f, debug_traceback); self.__transaction = nil; -- cgit v1.2.3 From 28202ed1c93c2a67e237f924c8305102bc40fa72 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 2 Sep 2015 14:14:22 +0200 Subject: util.sql: Export db2uri (mod_storage_sql2 command uses it) (thanks mike) --- util/sql.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/util/sql.lua b/util/sql.lua index 64f7c7fc..2d5e1774 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -329,4 +329,5 @@ return { Table = Table; Index = Index; create_engine = create_engine; + db2uri = db2uri; }; -- cgit v1.2.3 From 26a19efb5f3910e16d08523b25c6967ab80415d0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 2 Sep 2015 14:23:09 +0200 Subject: storagemanager: Export purge (fixes deleting users from usermanager) (thanks mt) --- core/storagemanager.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/core/storagemanager.lua b/core/storagemanager.lua index b72b84db..55f0800a 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -136,6 +136,7 @@ return { load_driver = load_driver; get_driver = get_driver; open = open; + purge = purge; olddm = olddm; }; -- cgit v1.2.3 From 2331a3d4b492787ba28598e8f972499c2c6a7637 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 2 Sep 2015 14:25:30 +0200 Subject: prosody: Set a luasocket global, fixes undefined global access in loop() (pending util.startup) --- prosody | 1 + 1 file changed, 1 insertion(+) diff --git a/prosody b/prosody index e6a23d8e..61be6c2e 100755 --- a/prosody +++ b/prosody @@ -121,6 +121,7 @@ end function load_libraries() -- Load socket framework + socket = require "socket"; server = require "net.server" end -- cgit v1.2.3 From d38f6999a38569d2e0bf649c49f990786871a978 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 2 Sep 2015 15:26:28 +0200 Subject: storagemanager: Check if drivers support purging, warn otherwise --- core/storagemanager.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/storagemanager.lua b/core/storagemanager.lua index 55f0800a..fb868d03 100644 --- a/core/storagemanager.lua +++ b/core/storagemanager.lua @@ -98,9 +98,14 @@ local function purge(user, host) if type(storage) == "table" then -- multiple storage backends in use that we need to purge local purged = {}; - for store, driver in pairs(storage) do - if not purged[driver] then - purged[driver] = get_driver(host, store):purge(user); + for store, driver_name in pairs(storage) do + if not purged[driver_name] then + local driver = get_driver(host, store); + if driver.purge then + purged[driver_name] = driver:purge(user); + else + log("warn", "Storage driver %s does not support removing all user data, you may need to delete it manually", driver_name); + end end end end -- cgit v1.2.3 From 63f8291d160b050741e804e5a58e392381555e14 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 2 Sep 2015 18:54:34 +0100 Subject: configure, Makefile: Make compatible with plain Bourne shell as used on Solaris. Fixes #418 (thanks jcea) --- Makefile | 6 +++--- configure | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f6e1e3f2..492d7ea5 100644 --- a/Makefile +++ b/Makefile @@ -41,8 +41,8 @@ install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodin umask 0022 && cp -r plugins/* $(MODULES) install -m644 certs/* $(CONFIG)/certs install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1 - test -e $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua - test -e prosody.version && install -m644 prosody.version $(SOURCE)/prosody.version || true + 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 $(MAKE) install -C util-src clean: @@ -66,7 +66,7 @@ prosody.cfg.lua.install: prosody.cfg.lua.dist sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' $^ > $@ prosody.version: $(wildcard prosody.release .hg/dirstate) - test -e .hg/dirstate && \ + test -d .hg/dirstate && \ hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || true test -f prosody.release && \ cp prosody.release $@ || true diff --git a/configure b/configure index 37f45f9b..53ee3757 100755 --- a/configure +++ b/configure @@ -227,7 +227,7 @@ find_program() { found="no" while [ "$item" ] do - if [ -e "$item/$1" ] + if [ -f "$item/$1" ] then found="yes" break @@ -250,7 +250,7 @@ then LUA_SUFFIX="$suffix" if [ "$LUA_DIR_SET" = "yes" ] then - if [ -e "$LUA_DIR/bin/lua$suffix" ] + if [ -f "$LUA_DIR/bin/lua$suffix" ] then find_lua="$LUA_DIR" fi @@ -265,7 +265,7 @@ then done fi -if ! [ "$LUA_DIR_SET" = "yes" ] +if [ "$LUA_DIR_SET" != "yes" ] then echo -n "Looking for Lua... " if [ ! "$find_lua" ] @@ -284,12 +284,12 @@ then fi fi -if ! [ "$LUA_INCDIR_SET" = "yes" ] +if [ "$LUA_INCDIR_SET" != "yes" ] then LUA_INCDIR="$LUA_DIR/include" fi -if ! [ "$LUA_LIBDIR_SET" = "yes" ] +if [ "$LUA_LIBDIR_SET" != "yes" ] then LUA_LIBDIR="$LUA_DIR/lib" fi @@ -311,7 +311,7 @@ fi echo -n "Checking Lua includes... " lua_h="$LUA_INCDIR/lua.h" -if [ -e "$lua_h" ] +if [ -f "$lua_h" ] then echo "lua.h found in $lua_h" else -- cgit v1.2.3