From bd97dfae3c89eb80420e0f464b9b4b81085df9bd Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Sep 27 2015 18:33:08 +0000 Subject: - Fixed shebang for ejabberd2prosody - Backported support for IPv6 DNS servers (#1256677) --- diff --git a/prosody-0.9.8-dns-ipv6.patch b/prosody-0.9.8-dns-ipv6.patch new file mode 100644 index 0000000..b8bf703 --- /dev/null +++ b/prosody-0.9.8-dns-ipv6.patch @@ -0,0 +1,78 @@ +Backport of upstream ticket "DNS lacks IPv6 support" (https://prosody.im/issues/issue/352) +using: + + - https://hg.prosody.im/0.10/rev/e108c3f97f26 + - https://hg.prosody.im/0.10/rev/0200945313c9 + - https://hg.prosody.im/0.10/rev/6eebd5808fbc + +--- prosody-0.9.8/net/dns.lua 2015-03-24 20:18:04.000000000 +0100 ++++ prosody-0.9.8/net/dns.lua.dns-ipv6 2015-09-11 21:46:39.000000000 +0200 +@@ -14,6 +14,7 @@ + + local socket = require "socket"; + local timer = require "util.timer"; ++local new_ip = require "util.ip".new_ip; + + local _, windows = pcall(require, "util.windows"); + local is_windows = (_ and windows) or os.getenv("WINDIR"); +@@ -599,11 +600,12 @@ + if resolv_conf then + for line in resolv_conf:lines() do + line = line:gsub("#.*$", "") +- :match('^%s*nameserver%s+(.*)%s*$'); ++ :match('^%s*nameserver%s+([%x:%.]*)%s*$'); + if line then +- line:gsub("%f[%d.](%d+%.%d+%.%d+%.%d+)%f[^%d.]", function (address) +- self:addnameserver(address) +- end); ++ local ip = new_ip(line); ++ if ip then ++ self:addnameserver(ip.addr); ++ end + end + end + end +@@ -623,7 +625,12 @@ + if sock then return sock; end + + local ok, err; +- sock, err = socket.udp(); ++ local peer = self.server[servernum]; ++ if peer:find(":") then ++ sock, err = socket.udp6(); ++ else ++ sock, err = socket.udp(); ++ end + if sock and self.socket_wrapper then sock, err = self.socket_wrapper(sock, self); end + if not sock then + return nil, err; +@@ -636,7 +643,7 @@ + -- if so, try the next server + ok, err = sock:setsockname('*', 0); + if not ok then return self:servfail(sock, err); end +- ok, err = sock:setpeername(self.server[servernum], 53); ++ sock:setpeername(peer, 53); + if not ok then return self:servfail(sock, err); end + return sock; + end +--- prosody-0.9.8/util/ip.lua 2015-03-24 20:18:04.000000000 +0100 ++++ prosody-0.9.8/util/ip.lua.dns-ipv6 2015-09-11 21:42:26.000000000 +0200 +@@ -12,7 +12,17 @@ + local hex2bits = { ["0"] = "0000", ["1"] = "0001", ["2"] = "0010", ["3"] = "0011", ["4"] = "0100", ["5"] = "0101", ["6"] = "0110", ["7"] = "0111", ["8"] = "1000", ["9"] = "1001", ["A"] = "1010", ["B"] = "1011", ["C"] = "1100", ["D"] = "1101", ["E"] = "1110", ["F"] = "1111" }; + + local function new_ip(ipStr, proto) +- if proto ~= "IPv4" and proto ~= "IPv6" then ++ if not proto then ++ local sep = ipStr:match("^%x+(.)"); ++ if sep == ":" or (not(sep) and ipStr:sub(1,1) == ":") then ++ proto = "IPv6" ++ elseif sep == "." then ++ proto = "IPv4" ++ end ++ if not proto then ++ return nil, "invalid address"; ++ end ++ elseif proto ~= "IPv4" and proto ~= "IPv6" then + return nil, "invalid protocol"; + end + if proto == "IPv6" and ipStr:find('.', 1, true) then diff --git a/prosody.spec b/prosody.spec index 722b090..b1fa51b 100644 --- a/prosody.spec +++ b/prosody.spec @@ -5,7 +5,7 @@ Summary: Flexible communications server for Jabber/XMPP Name: prosody Version: 0.9.8 -Release: 5%{?dist} +Release: 6%{?dist} License: MIT Group: System Environment/Daemons URL: https://prosody.im/ @@ -19,6 +19,7 @@ Source6: prosody-localhost.cfg.lua Source7: prosody-example.com.cfg.lua Patch0: prosody-0.9.8-config.patch Patch1: prosody-0.9.8-rhel5.patch +Patch2: prosody-0.9.8-dns-ipv6.patch BuildRequires: libidn-devel, openssl-devel Requires(pre): shadow-utils %if 0%{?rhel} > 6 || 0%{?fedora} > 17 @@ -60,6 +61,7 @@ added functionality, or prototype new protocols. %if 0%{?rhel} == 5 %patch1 -p1 %endif +%patch2 -p1 rm -f core/certmanager.lua.config %build @@ -94,7 +96,10 @@ make -C tools/migration DESTDIR=$RPM_BUILD_ROOT install # Install ejabberd2prosody install -p -m 755 tools/ejabberd2prosody.lua $RPM_BUILD_ROOT%{_bindir}/ejabberd2prosody sed -e 's@;../?.lua@;%{_libdir}/%{name}/util/?.lua;%{_libdir}/%{name}/?.lua;@' \ - -e '1s@ lua$@ lua-%{luaver}@' -i $RPM_BUILD_ROOT%{_bindir}/ejabberd2prosody +%if 0%{?rhel} > 7 || 0%{?fedora} > 19 + -e '1s@ lua$@ lua-%{luaver}@' \ +%endif + -i $RPM_BUILD_ROOT%{_bindir}/ejabberd2prosody touch -c -r tools/ejabberd2prosody.lua $RPM_BUILD_ROOT%{_bindir}/ejabberd2prosody install -p -m 644 tools/erlparse.lua $RPM_BUILD_ROOT%{_libdir}/%{name}/util/ @@ -218,6 +223,10 @@ fi %{_mandir}/man1/%{name}*.1* %changelog +* Sun Sep 27 2015 Robert Scheck 0.9.8-6 +- Fixed shebang for ejabberd2prosody +- Backported support for IPv6 DNS servers (#1256677) + * Sun Jul 23 2015 Robert Scheck 0.9.8-5 - Start after network-online.target not network.target (#1256062)