From: Matthew Wild Date: Mon, 16 Dec 2013 02:03:35 +0000 (+0000) Subject: util.jid: Strip trailing '.' when normalizing hostnames X-Git-Url: https://git.enpas.org/?a=commitdiff_plain;h=6a530b77c5ddb807e7bb1f60ec54f9d36f74313e;p=prosody.git util.jid: Strip trailing '.' when normalizing hostnames --- diff --git a/util/jid.lua b/util/jid.lua index 4c4371d8..8e0a784c 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -8,7 +8,7 @@ -local match = string.match; +local match, sub = string.match, string.sub; local nodeprep = require "util.encodings".stringprep.nodeprep; local nameprep = require "util.encodings".stringprep.nameprep; local resourceprep = require "util.encodings".stringprep.resourceprep; @@ -47,6 +47,9 @@ end local function _prepped_split(jid) local node, host, resource = _split(jid); if host then + if sub(host, -1, -1) == "." then -- Strip empty root label + host = sub(host, 1, -2); + end host = nameprep(host); if not host then return; end if node then