mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-14 13:40:26 +01:00
core: remove error checking for nm_auth_chain_new_subject() which cannot fail
nm_auth_chain_new_subject() cannot return %NULL, so these checks are only noise. Also, there are already calls that correctly rely on the fact that this function cannot fail. We use glib, where memory allocation by definition cannot fail. That means, a lot of functions simply cannot fail in our code base. This is a very nice property (to have an functions that cannot fail), so don't add error checking that is not useful.
This commit is contained in:
parent
b6a18e0593
commit
ad18612c36
2 changed files with 0 additions and 25 deletions
|
|
@ -2495,16 +2495,7 @@ nm_manager_device_auth_request(NMManager * self,
|
|||
&error))
|
||||
goto fail_on_idle;
|
||||
|
||||
/* Validate the request */
|
||||
chain = nm_auth_chain_new_subject(subject, context, device_auth_done_cb, self);
|
||||
if (!chain) {
|
||||
g_set_error(&error,
|
||||
NM_MANAGER_ERROR,
|
||||
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
||||
NM_UTILS_ERROR_MSG_REQ_AUTH_FAILED);
|
||||
goto fail_on_idle;
|
||||
}
|
||||
|
||||
if (cancellable)
|
||||
nm_auth_chain_set_cancellable(chain, cancellable);
|
||||
|
||||
|
|
@ -6033,15 +6024,7 @@ impl_manager_deactivate_connection(NMDBusObject * obj,
|
|||
&error))
|
||||
goto done;
|
||||
|
||||
/* Validate the user request */
|
||||
chain = nm_auth_chain_new_subject(subject, invocation, deactivate_net_auth_done_cb, self);
|
||||
if (!chain) {
|
||||
error = g_error_new_literal(NM_MANAGER_ERROR,
|
||||
NM_MANAGER_ERROR_PERMISSION_DENIED,
|
||||
NM_UTILS_ERROR_MSG_REQ_AUTH_FAILED);
|
||||
goto done;
|
||||
}
|
||||
|
||||
c_list_link_tail(&priv->auth_lst_head, nm_auth_chain_parent_lst_list(chain));
|
||||
nm_auth_chain_set_data(chain, "path", g_strdup(active_path), g_free);
|
||||
nm_auth_chain_add_call(chain, NM_AUTH_PERMISSION_NETWORK_CONTROL, TRUE);
|
||||
|
|
|
|||
|
|
@ -2521,17 +2521,9 @@ nm_settings_add_connection_dbus(NMSettings * self,
|
|||
else
|
||||
perm = NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM;
|
||||
|
||||
/* Validate the user request */
|
||||
chain = nm_auth_chain_new_subject(subject, context, pk_add_cb, self);
|
||||
if (!chain) {
|
||||
error = g_error_new_literal(NM_SETTINGS_ERROR,
|
||||
NM_SETTINGS_ERROR_PERMISSION_DENIED,
|
||||
NM_UTILS_ERROR_MSG_REQ_AUTH_FAILED);
|
||||
goto done;
|
||||
}
|
||||
|
||||
c_list_link_tail(&priv->auth_lst_head, nm_auth_chain_parent_lst_list(chain));
|
||||
|
||||
nm_auth_chain_set_data(chain, "perm", (gpointer) perm, NULL);
|
||||
nm_auth_chain_set_data(chain, "connection", g_object_ref(connection), g_object_unref);
|
||||
nm_auth_chain_set_data(chain, "callback", callback, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue