736 print(" VirtualHost. Alternatively, you can explicitly link them using the disco_items option."); |
736 print(" VirtualHost. Alternatively, you can explicitly link them using the disco_items option."); |
737 print(" For more information see https://prosody.im/doc/modules/mod_disco#items"); |
737 print(" For more information see https://prosody.im/doc/modules/mod_disco#items"); |
738 end |
738 end |
739 end |
739 end |
740 |
740 |
|
741 -- Check hostname validity |
|
742 do |
|
743 local idna = require "util.encodings".idna; |
|
744 local invalid_hosts = {}; |
|
745 local alabel_hosts = {}; |
|
746 for host in it.filter("*", pairs(configmanager.getconfig())) do |
|
747 local _, h, _ = jid_split(host); |
|
748 if not h or not idna.to_ascii(h) then |
|
749 table.insert(invalid_hosts, host); |
|
750 else |
|
751 for label in h:gmatch("[^%.]+") do |
|
752 if label:match("^xn%-%-") then |
|
753 table.insert(alabel_hosts, host); |
|
754 break; |
|
755 end |
|
756 end |
|
757 end |
|
758 end |
|
759 |
|
760 if #invalid_hosts > 0 then |
|
761 table.sort(invalid_hosts); |
|
762 print(""); |
|
763 print(" Your configuration contains invalid host names:"); |
|
764 print(" "..table.concat(invalid_hosts, "\n ")); |
|
765 print(""); |
|
766 print(" Clients may not be able to log in to these hosts, or you may not be able to"); |
|
767 print(" communicate with remote servers."); |
|
768 print(" Use a valid domain name to correct this issue."); |
|
769 end |
|
770 |
|
771 if #alabel_hosts > 0 then |
|
772 table.sort(alabel_hosts); |
|
773 print(""); |
|
774 print(" Your configuration contains incorrectly-encoded hostnames:"); |
|
775 for _, ahost in ipairs(alabel_hosts) do |
|
776 print((" '%s' (should be '%s')"):format(ahost, idna.to_unicode(ahost))); |
|
777 end |
|
778 print(""); |
|
779 print(" Clients may not be able to log in to these hosts, or you may not be able to"); |
|
780 print(" communicate with remote servers."); |
|
781 print(" To correct this issue, use the Unicode version of the domain in Prosody's config file."); |
|
782 end |
|
783 |
|
784 if #invalid_hosts > 0 or #alabel_hosts > 0 then |
|
785 print(""); |
|
786 print("WARNING: Changing the name of a VirtualHost in Prosody's config file"); |
|
787 print(" WILL NOT migrate any existing data (user accounts, etc.) to the new name."); |
|
788 ok = false; |
|
789 end |
|
790 end |
|
791 |
741 print("Done.\n"); |
792 print("Done.\n"); |
742 end |
793 end |
743 if not what or what == "dns" then |
794 if not what or what == "dns" then |
744 local dns = require "net.dns"; |
795 local dns = require "net.dns"; |
745 pcall(function () |
796 pcall(function () |