diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-25 15:27:37 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-26 13:05:50 +0200 |
commit | 12cdeb31ef996abbf5e4388db375d4d2f2fef05f (patch) | |
tree | 0fe5bf41abca546134df0000b52471d3a51651be | |
parent | 3a5d2c91dead2b629f73f64198ba645ba454bff1 (diff) | |
download | NetworkManager-12cdeb31ef996abbf5e4388db375d4d2f2fef05f.tar.gz |
libnm: allow empty "gsm.apn" setting in verify()
NetworkManager treats "gsm.apn" %NULL as setting an empty APN ("").
At least with ModemManager. With oFono, a %NULL APN means not to set
the "AccessPointName", so oFono implementation treats %NULL different
from "".
Soon ([1]) the meaning will change to allow %NULL to automatically
obtain the APN from the mobile-broadband-provider-info. That will be a
change in behavior how to treat %NULL.
Anyway, since %NULL is accepted and in fact means to actually use "",
the empty word should be also accepted to explicitly choose this
behavior. This is especially important in combination with changing the
meaning of %NULL.
[1] merge_requests/98
-rw-r--r-- | libnm-core/nm-setting-gsm.c | 2 | ||||
-rw-r--r-- | libnm-core/tests/test-general.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libnm-core/nm-setting-gsm.c b/libnm-core/nm-setting-gsm.c index a4049d1742..76da718b1f 100644 --- a/libnm-core/nm-setting-gsm.c +++ b/libnm-core/nm-setting-gsm.c @@ -290,7 +290,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) gsize apn_len = strlen (priv->apn); gsize i; - if (apn_len < 1 || apn_len > 64) { + if (apn_len > 64) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 601e3edc52..269d95a1f7 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -1755,7 +1755,7 @@ test_setting_gsm_apn_bad_chars (void) /* 0 characters long */ g_object_set (s_gsm, NM_SETTING_GSM_APN, "", NULL); - g_assert (!nm_setting_verify (NM_SETTING (s_gsm), NULL, NULL)); + g_assert (nm_setting_verify (NM_SETTING (s_gsm), NULL, NULL)); /* 65-character long */ g_object_set (s_gsm, NM_SETTING_GSM_APN, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl1", NULL); |