diff options
| author | Michael Biebl <biebl@debian.org> | 2022-03-07 21:30:42 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-03-07 21:30:42 +0100 |
| commit | 4f887bccf1cde84106588536584a2d54a5b4e6e5 (patch) | |
| tree | 454b1e2f3097b494dd9a4535815f382f214abf98 /src/core/nm-manager.c | |
| parent | 4e966a21b9ef4fb910a5bd1a5699d404a65cfe55 (diff) | |
New upstream version 1.36.2 upstream/1.36.2
Diffstat (limited to 'src/core/nm-manager.c')
| -rw-r--r-- | src/core/nm-manager.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index b440b224..6c73d237 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -7453,15 +7453,31 @@ impl_manager_checkpoint_create(NMDBusObject *obj, GDBusMethodInvocation *invocation, GVariant *parameters) { - NMManager *self = NM_MANAGER(obj); - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); - NMAuthChain *chain; - char **devices; - guint32 rollback_timeout; - guint32 flags; + NMManager *self = NM_MANAGER(obj); + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); + NMAuthChain *chain; + gs_strfreev char **devices = NULL; + guint32 rollback_timeout; + guint32 flags; G_STATIC_ASSERT_EXPR(sizeof(flags) <= sizeof(NMCheckpointCreateFlags)); + g_variant_get(parameters, "(^aouu)", &devices, &rollback_timeout, &flags); + + if ((NMCheckpointCreateFlags) flags != flags + || NM_FLAGS_ANY(flags, + ~((guint32) (NM_CHECKPOINT_CREATE_FLAG_DESTROY_ALL + | NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS + | NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES + | NM_CHECKPOINT_CREATE_FLAG_ALLOW_OVERLAPPING + | NM_CHECKPOINT_CREATE_FLAG_NO_PRESERVE_EXTERNAL_PORTS)))) { + g_dbus_method_invocation_return_error_literal(invocation, + NM_MANAGER_ERROR, + NM_MANAGER_ERROR_INVALID_ARGUMENTS, + "Invalid flags"); + return; + } + chain = nm_auth_chain_new_context(invocation, checkpoint_auth_done_cb, self); if (!chain) { g_dbus_method_invocation_return_error_literal(invocation, @@ -7471,11 +7487,12 @@ impl_manager_checkpoint_create(NMDBusObject *obj, return; } - g_variant_get(parameters, "(^aouu)", &devices, &rollback_timeout, &flags); - c_list_link_tail(&priv->auth_lst_head, nm_auth_chain_parent_lst_list(chain)); nm_auth_chain_set_data(chain, "audit-op", NM_AUDIT_OP_CHECKPOINT_CREATE, NULL); - nm_auth_chain_set_data(chain, "devices", devices, (GDestroyNotify) g_strfreev); + nm_auth_chain_set_data(chain, + "devices", + g_steal_pointer(&devices), + (GDestroyNotify) g_strfreev); nm_auth_chain_set_data(chain, "flags", GUINT_TO_POINTER(flags), NULL); nm_auth_chain_set_data(chain, "timeout", GUINT_TO_POINTER(rollback_timeout), NULL); nm_auth_chain_add_call(chain, NM_AUTH_PERMISSION_CHECKPOINT_ROLLBACK, TRUE); |