NetworkManager/clients/cli
Thomas Haller 2285dd38ea
cli: support backslash escaping in passwd-file
Rework parsing of nmcli's passwd-file.

1) support backslash escaping of secrets.

  - only the secret can be backslash escaped, the property and setting
    name cannot.

  This is a change in behavior for passwd-files with secrets that contain
  a backslash.

2) strip the white space around the secret. This is a change in behavior
  for secrets that had leading or trailing spaces. Note that you can
  backslash escape spaces in secrets.

3) strip white space around the setting.property key. This is also a
  change in behavior, but such keys would never have been valid
  previously (or the caller would have performed the same kind of
  stripping).

4) accept '=' as alternative delimiter beside ':'. The ':' feels really
  odd and unexpected. Also accept '='. This is a change in behavior if
  keys would contain '=', which they really shouldn't.

5) reject non-UTF-8 secrets and keys. For keys, that is not an issue,
  because such keys were never valid. For secrets, it probably didn't
  work anyway to specify non-UTF-8 secrets, because most (if not all)
  secrets are transmitted via D-Bus as strings where arbitrary binary
  is not allowed.

6) ignore empty lines and lines starting with '#'.

7) ensure we don't leak any secrets in memory.

1) to 4) are changes in behavior. 3) and 4) seem less severe, as they
only concern unusual setting.property keys, which really shouldn't be
used (although, VPN secrets can have almost arbitrary names *sigh*).
1) and 2) is more dangerous, as it changes behavior for secrets that
contain backslashes or leading/trailing white space.
2020-05-13 10:28:04 +02:00
..
agent.c cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
common.c cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
common.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00
connections.c cli: support backslash escaping in passwd-file 2020-05-13 10:28:04 +02:00
connections.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00
devices.c cli: avoid empty if block without a comment 2020-05-07 13:58:09 +02:00
devices.h cli: cleanup NMCCommand and declarations of func implementations 2020-04-10 10:27:27 +02:00
general.c cli: avoid empty if block without a comment 2020-05-07 13:58:09 +02:00
meson.build license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
nmcli-completion cli: make nmcli do its own command completion 2017-02-13 16:32:15 +01:00
nmcli.c cli: unref main loop after destroying NMClient instance 2020-05-12 23:00:01 +02:00
nmcli.h cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
polkit-agent.c cli/polkit: rename NM_POLKIT_LISTENER_SIGNAL_REQUEST signal to "request-sync" 2020-04-10 10:44:52 +02:00
polkit-agent.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
settings.c cli: hide nm_cli global variable from public headers 2020-04-04 19:28:41 +02:00
settings.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
utils.c cli: let _print_fill() hide option if NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE is set 2020-04-16 10:52:45 +02:00
utils.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00