NetworkManager/clients/common
Thomas Haller 47a654d398 clients: use nm_utils_ifname_valid() to validate interface name in nm_vpn_wireguard_import()
We use the filename of the imported .conf file for "connection.interface-name".
That follows what `wg-quick` does.

However, we also validate that the interface name is valid UTF-8
(otherwise -- as it currently is -- the setting couldn't be send via
D-Bus). As such, we have stricter requirements.

We want to fail early and tell the user when the filename is unsuitable.
Failing later gives a worse user experience, because the failure message
about invalid "connection.interface-name" wouldn't make it clear that
the filename is wrong.

Use the appropriate function to validate "connection.interface-name".

Before:

    $ touch $'./a\344b.conf'
    $ nmcli connection import type wireguard file $'./a\344b.conf'
    Error: failed to import './a?b.conf': Failed to create WireGuard connection: connection.interface-name: 'a?b': interface name must be UTF-8 encoded.

Now:

    $ nmcli connection import type wireguard file $'./a\344b.conf'
    Error: failed to import './a?b.conf': The name of the WireGuard config must be a valid interface name followed by ".conf".
2020-02-26 17:51:13 +01:00
..
tests all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
meson.build clients: polkit-agent: implement polkit agent without using libpolkit 2019-12-24 10:13:51 +01:00
nm-client-utils.c clients: avoid compiler warning about redefining NDEBUG for qrcodegen 2020-01-15 22:25:21 +01:00
nm-client-utils.h cli: add "nmcli d wifi show" 2019-10-18 17:38:57 +02:00
nm-meta-setting-access.c all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-meta-setting-access.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-meta-setting-desc.c nmcli: remove interface length check in nmcli 2020-02-17 15:27:35 +01:00
nm-meta-setting-desc.h clients: add missing 'extern' keyword 2020-02-03 11:00:34 +01:00
nm-polkit-listener.c all: add nm_utils_error_is_cancelled() and nm_utils_error_is_cancelled_or_disposing() 2020-02-10 19:11:50 +01:00
nm-polkit-listener.h clients: polkit-agent: implement polkit agent without using libpolkit 2019-12-24 10:13:51 +01:00
nm-secret-agent-simple.c clients/secret-agent: don't require secrets for OWE connections 2019-12-05 14:00:10 +01:00
nm-secret-agent-simple.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
nm-vpn-helpers.c clients: use nm_utils_ifname_valid() to validate interface name in nm_vpn_wireguard_import() 2020-02-26 17:51:13 +01:00
nm-vpn-helpers.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
qrcodegen.c cli: add "nmcli d wifi show" 2019-10-18 17:38:57 +02:00
qrcodegen.h cli: add "nmcli d wifi show" 2019-10-18 17:38:57 +02:00
settings-docs.h.in libnm,cli,ifcfg-rh: add ipv6.ra-timeout configuration option 2020-02-17 14:43:13 +01:00
settings-docs.xsl cli: fix marking settings docs for translation 2017-04-23 23:45:02 +02:00