NetworkManager/src/libnmc-setting
Thomas Haller ea67f48050
cli: handle empty/unset values for "gsm.apn" property
Most string properties can be either %NULL (unset) or a non-empty
string.

For a few properties, like "gsm.apn", also the empty word is a valid
value. That makes it problematic to use from nmcli, because

  nmcli connection modify "$PROFILE" gsm.apn ""

means to reset the default (NULL). How to configure the empty word?
For the APN, "" has a specific meaning, distinct from NULL, so we
need to be able to represent that.

The other problem with nmcli is that

  nmcli -g gsm.apn connection show "$PROFILE"

is supposed to give you a value that you an set again, like

  X="$(nmcli -g gsm.apn connection show "$PROFILE"; echo x)"
  nmcli connection modify "$PROFILE2" gsm.apn "${X%$'\n'x}"

but for %NULL and "" the output would be the same.

The "solution" to that is interpreting "" as NULL (like we always did)
and a non-empty string that contains all whitespace, like a string with
one whitespace less. This way, all values can be expressed.

Note that in case of "gsm.apn", the string is anyway internally
normalized with g_strstrip(), so a string with all whitespace was
not expressable.
2021-05-03 10:11:25 +02:00
..
tests build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
meson.build build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-access.c build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-access.h build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-base-impl.c build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-base-impl.h build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-base.h build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-meta-setting-desc.c cli: handle empty/unset values for "gsm.apn" property 2021-05-03 10:11:25 +02:00
nm-meta-setting-desc.h build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
settings-docs.h.in wired-setting: add support to accept-all-mac-addresses 2021-04-22 18:57:30 +00:00
settings-docs.xsl build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00