aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2014-08-07 17:20:51 +0200
committerKim Alvefur <zash@zash.se>2014-08-07 17:20:51 +0200
commit8aabc3b56c2dee60cc275f51c922cda0a7e30970 (patch)
tree01b2733683a9a8c4edf7c6ab7d4d91d3a0573a56 /util
parent156699311201d7cf23f8e680cbee1bcf1622b159 (diff)
downloadprosody-8aabc3b56c2dee60cc275f51c922cda0a7e30970.tar.gz
prosody-8aabc3b56c2dee60cc275f51c922cda0a7e30970.zip
util.jid: Return early in join on invalid jids
Diffstat (limited to 'util')
-rw-r--r--util/jid.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/util/jid.lua b/util/jid.lua
index 08e63335..5db3d1f0 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -79,16 +79,15 @@ function prep(jid)
end
function join(node, host, resource)
- if node and host and resource then
+ if not host then return end -- Invalid JID
+ if node and resource then
return node.."@"..host.."/"..resource;
- elseif node and host then
+ elseif node then
return node.."@"..host;
- elseif host and resource then
+ elseif resource then
return host.."/"..resource;
- elseif host then
- return host;
end
- return nil; -- Invalid JID
+ return host;
end
function compare(jid, acl)