diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 4b37c64b9a..b32e3d8cd6 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -24,10 +24,8 @@ TACPLUS_SERVER_TIMEOUT_DEFAULT = "5" TACPLUS_SERVER_AUTH_TYPE_DEFAULT = "pap" -def is_valid_hostname(name): - if hostname[-1] == ".": - hostname = hostname[:-1] # strip exactly one dot from the right, if present - if len(hostname) > 253: +def is_valid_hostname(hostname): + if hostname[-1] == "." or len(hostname) > 253: return False allowed = re.compile("(?!-)[A-Z\d-]{1,63}(?