mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 01:47:58 +02:00
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.
This commit is contained in:
parent
fab1116494
commit
ca58bcca0c
1 changed files with 23 additions and 0 deletions
|
|
@ -4834,6 +4834,17 @@ add_new_connection (gboolean persistent,
|
|||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if ( !nm_connection_verify (connection, &error)
|
||||
|| !nm_connection_verify_secrets (connection, &error)) {
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (client),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
nm_client_add_connection_async (client, connection, persistent,
|
||||
NULL, callback, user_data);
|
||||
}
|
||||
|
|
@ -4844,6 +4855,18 @@ update_connection (gboolean persistent,
|
|||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if ( !nm_connection_verify (NM_CONNECTION (connection), &error)
|
||||
|| !nm_connection_verify_secrets (NM_CONNECTION (connection), &error)) {
|
||||
g_simple_async_report_take_gerror_in_idle (G_OBJECT (connection),
|
||||
callback,
|
||||
user_data,
|
||||
error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
nm_remote_connection_commit_changes_async (connection, persistent,
|
||||
NULL, callback, user_data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue