Commit graph

22144 commits

Author SHA1 Message Date
Benjamin Berg
60691d76ad libnm: Add async start/stop routines for P2P find operations
These were dropped earlier as new sync API must not be the primary way
of calling new routines in libnm.

In this particular case the DBus calls are simple and unlikely to fail.
Most users should use the normal async API and call the finish routine.
However, if the API user is not interested in the result, then they can
simply set the callback to NULL to ignore it.

[thaller@redhat.com: added options argument to start-find method]
2019-02-05 13:55:13 +01:00
Thomas Haller
f1714b485d gitlab-ci: minor cleanup of "contrib/scripts/nm-ci-run.sh" script 2019-02-05 13:49:20 +01:00
Thomas Haller
f444188b63 wwan: avoid deprecated mm_simple_connect_properties_set_number()
Since 1.10, mm_simple_connect_properties_set_number() is deprecated
and calling it does nothing. Moreover, it triggers a
"deprecated-declarations" warning.

Avoid calling it.

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/99
55c3026643
2019-02-05 13:42:36 +01:00
Thomas Haller
8cb2d193e4 build/autotools: dist test files for ifcfg-rh tests
Fixes: 386e75ee04
2019-02-05 12:54:03 +01:00
Thomas Haller
ce2f3d8c1e man: explain purpose of connectivity checking in man NetworkManager.conf 2019-02-05 11:12:07 +01:00
Thomas Haller
dc1187a161 clients/tests: fix client tests
Fixes: d081aa1d84
2019-02-05 11:12:07 +01:00
Lubomir Rintel
d081aa1d84 merge: branch 'lr/sae'
This adds support for SAE authentication as used for 802.11s Meshing, but
also WPA3-Personal.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/9
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/65
2019-02-05 10:21:25 +01:00
Lubomir Rintel
ca58bcca0c cli: verify connections before sending them over to daemon
This way we generate the error messages on the client side and therefore
can localize them.
2019-02-05 10:20:30 +01:00
Lubomir Rintel
fab1116494 clients/cli: if the AP supports SAE, claim WPA3 support
RSN with SAE is what's called WPA3-Personal.
Also, if there's neither PSK nor 802.1x, it's not WPA2.
2019-02-05 10:20:30 +01:00
Lubomir Rintel
640164e979 clients/test: vary RSN capabilities across APs
This allows us to test if we distinguish WPA1, WPA2 and WPA3 in the
client.
2019-02-05 10:20:29 +01:00
Lubomir Rintel
245c9c93d1 clients/cli: don't translate abbreviations 2019-02-05 10:20:27 +01:00
Lubomir Rintel
2344e958cf client/cli: send a PSK when using SAE 2019-02-05 10:20:27 +01:00
Lubomir Rintel
998ebe731e client/cli: add support for SAE key management flag 2019-02-05 10:20:27 +01:00
Lubomir Rintel
ab0d348792 client/devices: get rid of useless g_strdup()s
And, while at that, add a hint to the developer adding new items. It's
helps avoid a mistake that I believe is common (because I just made it
twice...).
2019-02-05 10:20:27 +01:00
Lubomir Rintel
fa2fe3688d clients/secret-agent: respond to SAE password requests 2019-02-05 10:20:27 +01:00
Lubomir Rintel
fd64417f1d clients/meta-setting-desc: allow setting wifi-sec.key-mgmt to SAE 2019-02-05 10:20:27 +01:00
Lubomir Rintel
8c91e8deaa wifi/utils: complete key-mgmt=sae for SAE capable APs
Ordered before wpa-psk so that if the AP supports both WPA-PSK and SAE,
SAE ends up preferred.
2019-02-05 10:20:27 +01:00
Lubomir Rintel
386e75ee04 settings/ifcfg: add support for KEY_MGMT=SAE 2019-02-05 10:20:27 +01:00
Lubomir Rintel
6640fb4b36 supplicant: add support for SAE key management
When SAE key managmenet is used, the supplicant can still use the "psk"
property. Only when the pass phrase doesn't conform to WPA-PSK
limitations, the sae_password must be used.
2019-02-05 10:20:27 +01:00
Lubomir Rintel
2d3e42b5a7 libnm-core/setting-wireless-security: add support for SAE key management
This adds support for configuring the Wi-Fi connections to use SAE. SAE
is a password-based authentication mechanism that replaces WPA-PSK in
WPA3-Personal.

The pass phrase is still stored in the "psk" property, with some
limitations lifted.
2019-02-05 10:20:27 +01:00
Lubomir Rintel
5af08ded75 wifi/ap: expose SAE capability
wpa_supplicant as of version 2.7 still doesn't tell us whether it
supports SAE.

Patch in review: http://lists.infradead.org/pipermail/hostap/2019-January/039338.html
2019-02-05 10:20:27 +01:00
Lubomir Rintel
04f3476029 libnm-core/dbus: add flag that indicates SAE support for an AP 2019-02-05 10:20:27 +01:00
Lubomir Rintel
49ac11f84b clients/common: drop unuseful wifi-sec.psk validation
The generic connection validation produces a good result:
  Error: failed to modify 802-11-wireless-security.psk: ':(' is not a valid PSK.
vs.:
  Error: Failed to add 'wifi666' connection: 802-11-wireless-security.psk: property is invalid
2019-02-05 10:20:27 +01:00
Lubomir Rintel
009f756086 settings: don't allow updating a connection with invalid secrets
Validate them, like we do on a connection addition.
2019-02-05 10:20:27 +01:00
Lubomir Rintel
58ee6be348 man: fix a typo 2019-02-05 10:20:27 +01:00
Thomas Haller
c67ebc8abf build/meson: add intermediate shared/nm-utils base library
Like also done for autotools, create and use intermediate libraries
from "shared/nm-utils/".

Also, replace "shared_dep" by "shared_nm_utils_base_dep". We don't
need super fine-grained selection of what we link. We can always
link in "shared/libnm-utils-base.a", and let the linker throw away
unsed parts.
2019-02-05 09:53:24 +01:00
Thomas Haller
15995c9700 build/meson: always set SESSION_TRACKING_SYSTEMD define
Like we do with autotools, otherwise we get a warning:

    [576/1030] Compiling C object src/25a6634@@NetworkManager@sta/nm-session-monitor.c.o.
    ../src/nm-session-monitor.c:31:5: warning: "SESSION_TRACKING_SYSTEMD" is not defined, evaluates to 0 [-Wundef]
     #if SESSION_TRACKING_SYSTEMD && SESSION_TRACKING_ELOGIND
         ^~~~~~~~~~~~~~~~~~~~~~~~
2019-02-05 09:51:27 +01:00
Thomas Haller
d3d8611066 secret-agent: merge branch 'th/secret-agent-cleanup'
https://github.com/NetworkManager/NetworkManager/pull/288
2019-02-05 08:42:40 +01:00
Thomas Haller
472f89da6b wifi,clients/secret-agent: use defines for property names in secret hints 2019-02-05 08:34:23 +01:00
Thomas Haller
bd590579da core: pass hints as strv to nm_act_request_get_secrets()
Extend nm_act_request_get_secrets() API to allow for the underlying
flexibility (of the API that it calls) to accept a strv list of hints.
2019-02-05 08:34:23 +01:00
Thomas Haller
787f5f7a46 clients/secret-agent: refactor code in request_secrets_from_ui() to return early 2019-02-05 08:34:23 +01:00
Thomas Haller
1a0fc8d437 clients/secret-agent: fix leaks in request_secrets_from_ui()
Fixes: 3bda3fb60c
2019-02-05 08:34:23 +01:00
Thomas Haller
883978ec99 clients/secret-agent: use g_hash_table_get_keys_as_array() in nm_secret_agent_simple_enable() 2019-02-05 08:34:23 +01:00
Thomas Haller
d52fd81b91 libnm/secret-agent/trivial: rename internal init-data structure
No "NM" prefix for internal structure.
2019-02-05 08:34:23 +01:00
Thomas Haller
43b3e19c88 libnm/secret-agent: use cleanup attribute in NMSecretAgentOldPrivate
Refactor memory handling to use cleanup attribute.
2019-02-05 08:34:23 +01:00
Thomas Haller
ee9e980814 libnm/secret-agent: reorder fields in NMSecretAgentOldPrivate
And don't waste 4 bytes per boolean.
2019-02-05 08:34:23 +01:00
Thomas Haller
b9a7f1974b libnm/secret-agent: use CList instead of GSList for tracking requests
Always always when we want a linked list, CList is a better choice than
GSList. It's more convenient to use and is more efficient.

Also, use GSlice allocator for GetSecretRequest data.
2019-02-05 08:34:23 +01:00
Thomas Haller
72f90a8fbc clients/secret-agent: fix cancel_get_secrets() implementation
The callback must be invoked, as also documented.

Otherwise, the tracked info gets leaked.

Let NMSecretAgentOld (the caller) be a bit resilient against
bugs in the client, and avoid a crash by prematurely remove
the request-info from the pending list. That does not fully
workaround the bug (it leads to a leak), but at least it does
not cause other "severe" issues.

The leak was present earlier as well.
2019-02-05 08:34:23 +01:00
Thomas Haller
fb4a188350 libnm/secret-agent: refactor GObject properties in NMSecretAgentOld
Use NM_GOBJECT_PROPERTIES_DEFINE() and _notify() and get rid of
the extra tab for indentation.
2019-02-05 08:34:13 +01:00
Thomas Haller
99ae86d824 libnm/secret-agent: reorder code 2019-02-05 08:34:07 +01:00
Thomas Haller
99497a7674 clients/secret-agent: sink reference for variant passed to callback
NMSecretAgentOld's get_secrets_cb() gets this right and takes
a floating reference. So this was correct.

However, make this a bit more robust, and don't pass on
floating references. This was, we don't require the callee
to consume the reference.
2019-02-05 08:31:44 +01:00
Thomas Haller
c9ca1186c2 clients/secret-agent: add complete function for invoking secret callback
The completion of the request and the deletion usually goes hand in
hand. Add a function to unify them.
2019-02-05 08:27:43 +01:00
Thomas Haller
93c848ca03 clients: don't tread secret agent as NMSecretAgentOld
Most of the times we actually need a NMSecretAgentSimple typed pointer.
This way, need need to cast less.

But even if we would need to cast more, it's better to have pointers
point to the actual type, not merely to avoid shortcomings of C.
2019-02-05 08:27:42 +01:00
Thomas Haller
82472c557c clients/secret-agent: use nm-utils error reason for callback while disposing NMSecretAgentSimple
No caller cared about the NM_SECRET_AGENT_ERROR_AGENT_CANCELED reason.
In particular, because previously the requests would keep the secret-agent
instance alive, and this never happend.

Also, NM_SECRET_AGENT_ERROR_AGENT_CANCELED precicley exists for
NMSecretAgentOld:cancel_get_secrets() (as documented). During finalize
we are not cancelled -- at least not the same way as
cancel_get_secrets(). Setting NM_SECRET_AGENT_ERROR_AGENT_CANCELED
is wrong.

Anyway, we have a default error for such cases already.
2019-02-05 08:27:42 +01:00
Thomas Haller
d68bdce206 clients/secret-agent: minor cleanup of child-watch-id for secret-agent
The code was correct. But it's hard to follow when and whether
the child-watch-id was destroyed at the right time.

Instead, always let _auth_dialog_data_free() clear the signal handlers.
2019-02-05 08:27:42 +01:00
Thomas Haller
8b951afac9 clients/secret-agent: don't let request keep secret-agent alive
Don't let RequestData keep the parent NMSecretAgentSimple instance
alive. Previously, the code in finalize() was never actually reached.

Also, move the final callback from finalize() to dispose(). It feels
wrong to invoke callbacks from finalize().
2019-02-05 08:27:42 +01:00
Thomas Haller
16e0f38c3e clients/secret-agent: cancel pending operations
We must actually cancel the GCancellable. Otherwise, the pending async
operations are not cancelled. _auth_dialog_write_done() doesn't care
about that, but _auth_dialog_read_done() does. It must not touch the
destroyed data, after the operation is cancelled.
2019-02-05 08:27:42 +01:00
Thomas Haller
f2973fd72e clients/secret-agent: remove request in finalize loop early
It's ugly to keep the request in the list. Just remove it
right away.
2019-02-05 08:27:42 +01:00
Thomas Haller
4157092a8a clients/secret-agent: rework tracking of requests in secret-agent-simple
Note that previously the @requests hash took the request-id as key and
the RequestData as value. Likewise, the destroy functions of the head
would destroy the key and the value.

However, RequestData also had a field "request_id". But that pointer was
not owned (nor freed) by the RequestData structure. Instead, it was
relied that the hash kept the request-id alive long enough.

That is confusing. Let RequestData own the request-id.

Also, we don't need to track a separate key. Just move the request-id
as first filed in RequestData, and use compare/hash functions that
handle that correctly (nm_pstr_*()).
2019-02-05 08:27:12 +01:00
Thomas Haller
5572c8f81c clients/secret-agent: only pass char buffer to _auth_dialog_write_done()
We don't need the entire GString. It's only to keep the buffer alive
for long enough.
2019-02-05 08:22:01 +01:00