Systemd/src/network
Zbigniew Jędrzejewski-Szmek 7470cc4c73 resolve: reject host names with leading or trailing dashes in /etc/hosts
https://tools.ietf.org/html/rfc1035#section-2.3.1 says (approximately)
that only letters, numbers, and non-leading non-trailing dashes are allowed
(for entries with A/AAAA records). We set no restrictions.

hosts(5) says:
> Host names may contain only alphanumeric characters, minus signs ("-"), and
> periods (".").  They must begin with an alphabetic character and end with an
> alphanumeric character.

nss-files follows those rules, and will ignore names in /etc/hosts that do not
follow this rule.

Let's follow the documented rules for /etc/hosts. In particular, this makes us
consitent with nss-files, reducing surprises for the user.

I'm pretty sure we should apply stricter filtering to names received over DNS
and LLMNR and MDNS, but it's a bigger project, because the rules differ
depepending on which level the label appears (rules for top-level names are
stricter), and this patch takes the minimalistic approach and only changes
behaviour for /etc/hosts.

Escape syntax is also disallowed in /etc/hosts, even if the resulting character
would be allowed. Other tools that parse /etc/hosts do not support this, and
there is no need to use it because no allowed characters benefit from escaping.
2018-12-10 09:56:56 +01:00
..
netdev Merge pull request #10976 from yuwata/typesafe-netlink-call 2018-12-03 17:55:00 +01:00
wait-online Split out pretty-print.c and move pager.c and main-func.h to shared/ 2018-11-20 18:40:02 +01:00
fuzz-netdev-parser.c util-lib: split out all temporary file related calls into tmpfiles-util.c 2018-12-02 13:22:29 +01:00
fuzz-network-parser.c util-lib: split out all temporary file related calls into tmpfiles-util.c 2018-12-02 13:22:29 +01:00
meson.build networkd: make network_load_one "public" and add a fuzzer for it 2018-11-06 19:01:32 +01:00
networkctl.c Split out pretty-print.c and move pager.c and main-func.h to shared/ 2018-11-20 18:40:02 +01:00
networkd-address-label.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-address-label.h network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-address-pool.c network: use structured initializers 2018-11-12 16:32:10 +09:00
networkd-address-pool.h tree-wide: remove Lennart's copyright lines 2018-06-14 10:20:20 +02:00
networkd-address.c Merge pull request #10920 from yuwata/hashmap-destructor 2018-12-03 17:59:44 +01:00
networkd-address.h network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-brvlan.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-brvlan.h tree-wide: use proper unicode © instead of (C) where we can 2018-06-14 10:20:20 +02:00
networkd-conf.c network: accept additional time-value after ':' when DUIDType=link-layer-time 2018-08-08 10:15:00 +09:00
networkd-conf.h tree-wide: beautify remaining copyright statements 2018-06-14 10:20:21 +02:00
networkd-dhcp4.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-dhcp6.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-fdb.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-fdb.h network: use NetworkConfigSection in fdb entries 2018-11-12 16:32:10 +09:00
networkd-gperf.gperf network: accept additional time-value after ':' when DUIDType=link-layer-time 2018-08-08 10:15:00 +09:00
networkd-ipv4ll.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-ipv6-proxy-ndp.c network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-ipv6-proxy-ndp.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
networkd-link-bus.c tree-wide: drop copyright headers from frequent contributors 2018-06-20 11:58:53 +02:00
networkd-link.c Merge pull request #10976 from yuwata/typesafe-netlink-call 2018-12-03 17:55:00 +01:00
networkd-link.h network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-lldp-tx.c util-lib: split out env file parsing code into env-file.c 2018-12-02 13:22:29 +01:00
networkd-lldp-tx.h tree-wide: use CONFIG_PARSER_PROTOTYPE() macro 2018-11-12 16:45:04 +09:00
networkd-manager-bus.c network: replace udev_device by sd_device 2018-08-23 04:57:39 +09:00
networkd-manager.c Merge pull request #10920 from yuwata/hashmap-destructor 2018-12-03 17:59:44 +01:00
networkd-manager.h network: replace udev_monitor by sd_device_monitor 2018-10-17 03:31:20 +09:00
networkd-ndisc.c Merge pull request #10920 from yuwata/hashmap-destructor 2018-12-03 17:59:44 +01:00
networkd-ndisc.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
networkd-network-bus.c tree-wide: drop copyright headers from frequent contributors 2018-06-20 11:58:53 +02:00
networkd-network-gperf.gperf network: rename Protocol= in [RoutingPolicyRule] to IPProtocol= 2018-12-02 06:13:47 +01:00
networkd-network.c resolve: reject host names with leading or trailing dashes in /etc/hosts 2018-12-10 09:56:56 +01:00
networkd-network.h network: allocate hashmap objects when they are required 2018-11-12 16:32:11 +09:00
networkd-radv.c networkd: refuse IPv6 RADV prefixes that lack Prefix= setting 2018-11-30 22:19:28 +01:00
networkd-radv.h tree-wide: beautify remaining copyright statements 2018-06-14 10:20:21 +02:00
networkd-route.c util: drop missing.h from util.h 2018-12-04 10:00:34 +01:00
networkd-route.h network: use typesafe netlink_call_async() macro where applicable 2018-12-02 06:29:32 +01:00
networkd-routing-policy-rule.c Merge pull request #10920 from yuwata/hashmap-destructor 2018-12-03 17:59:44 +01:00
networkd-routing-policy-rule.h util: drop missing.h from util.h 2018-12-04 10:00:34 +01:00
networkd-util.c tree-wide: drop copyright headers from frequent contributors 2018-06-20 11:58:53 +02:00
networkd-util.h tree-wide: drop double newline 2018-06-29 11:02:17 +09:00
networkd.c log: introduce new helper call log_setup_service() 2018-11-20 11:18:22 +01:00
networkd.conf network: provide default networkd.conf 2018-06-26 03:34:49 +09:00
org.freedesktop.network1.conf networkd: add basic dbus API 2015-02-05 11:50:34 +01:00
org.freedesktop.network1.service Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
systemd-networkd.pkla network: request product UUID when DUIDType=uuid but DUIDRawData= is not set 2018-08-08 10:15:00 +09:00
systemd-networkd.rules network: request product UUID when DUIDType=uuid but DUIDRawData= is not set 2018-08-08 10:15:00 +09:00
test-network-tables.c test: add tests for string tables for lldp and ndisc events 2018-11-06 20:15:09 +09:00
test-network.c tests: use a helper function to parse environment and open logging 2018-09-14 09:29:57 +02:00
test-networkd-conf.c network: allocate hashmap objects when they are required 2018-11-12 16:32:11 +09:00
test-routing-policy-rule.c util-lib: split out all temporary file related calls into tmpfiles-util.c 2018-12-02 13:22:29 +01:00