Re: [libvirt PATCH] conf: network: remove hostname validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/27/22 4:33 PM, Ján Tomko wrote:
We used to validate that the first character of the hostname is a
letter. Later, RFC1123 relaxed the requirements to allow a number
as well.

Drop the validation completely, since we do not care about the
following characters, and neither does dnsmasq (even if it's a comma,
which is a delimiter in the hosts file).

Was there some discussion somewhere that prompted this patch (and thus invalidates the opinion I'm about to spout)? The only email I could find about it was the email of the "reverted" patch itself (sent by Peter on behalf of the author, with r-b given in the same email).

My opinion is that if a current RFC restricts the first letter of a hostname, then we should validate that too, *especially* if dnsmasq doesn't; who knows what entity beyond dnsmasq will barf on it in some way, and the closer to the source the non-compliance is reported, the easier it will be to fix. (Additionally, it's easy to remove extra validation, but much more difficult to add it back later if we decide it shouldn't have been removed)



Reverts: 673b74be5fda928da5e9f3c2cfbf6c1cb1eda0c6
Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
  src/conf/network_conf.c | 6 ------
  1 file changed, 6 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index c769bbaeb5..8f50e22be5 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -548,12 +548,6 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
      }
name = virXMLPropString(node, "name");
-    if (name && !(g_ascii_isalpha(name[0]) || g_ascii_isdigit(name[0]))) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("Cannot use host name '%s' in network '%s'"),
-                       name, networkName);
-        return -1;
-    }
ip = virXMLPropString(node, "ip");
      if (ip && (virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux