From 7343e0e184a15eb56dc0ae1ee9bbc8ef60871704 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Thu, 11 Jun 2020 08:54:42 +0200 Subject: 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) --- src/conf_mode/host_name.py | 21 +++++---------------- 1 file 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(): -- cgit v1.2.3