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