summaryrefslogtreecommitdiff
path: root/src/conf_mode/host_name.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-06-11 08:54:42 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-06-11 22:10:47 +0200
commit7343e0e184a15eb56dc0ae1ee9bbc8ef60871704 (patch)
tree647742d7e6798ed5584d313ebd4e145ebdf4492c /src/conf_mode/host_name.py
parentb3af8156e774198b5ca14bb6b21084a95ef1a256 (diff)
downloadvyos-1x-7343e0e184a15eb56dc0ae1ee9bbc8ef60871704.tar.gz
vyos-1x-7343e0e184a15eb56dc0ae1ee9bbc8ef60871704.zip
host_name: T2486: remove domain-search length limitations
Debian Buster doesn't have the length and character limitations of /etc/resolv.conf 'search' any more, it is unlimited. https://sourceware.org/bugzilla/show_bug.cgi?id=19569 (glibc >2.26)
Diffstat (limited to 'src/conf_mode/host_name.py')
-rwxr-xr-xsrc/conf_mode/host_name.py21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index a4794f041..4fe7b4cbd 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -78,32 +78,21 @@ def get_config():
return hosts
-def verify(config):
- if config is None:
+def verify(conf, hosts):
+ if hosts is None:
return None
# pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$" ; "invalid host name $VAR(@)"
hostname_regex = re.compile("^[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]$")
- if not hostname_regex.match(config['hostname']):
- raise ConfigError('Invalid host name ' + config["hostname"])
+ if not hostname_regex.match(hosts['hostname']):
+ raise ConfigError('Invalid host name ' + hosts["hostname"])
# pattern $VAR(@) "^.{1,63}$" ; "invalid host-name length"
- length = len(config['hostname'])
+ length = len(hosts['hostname'])
if length < 1 or length > 63:
raise ConfigError(
'Invalid host-name length, must be less than 63 characters')
- # The search list is currently limited to six domains with a total of 256 characters.
- # https://linux.die.net/man/5/resolv.conf
- if len(config['domain_search']) > 6:
- raise ConfigError(
- 'The search list is currently limited to six domains')
-
- tmp = ' '.join(config['domain_search'])
- if len(tmp) > 256:
- raise ConfigError(
- 'The search list is currently limited to 256 characters')
-
all_static_host_mapping_addresses = []
# static mappings alias hostname
for host, hostprops in hosts['static_host_mapping'].items():