audit-manager: don't log connection whose addition fails

In AddAndActivate the uuid and id make no sense until authorization succeeds
and the connection is saved.
This commit is contained in:
Lubomir Rintel 2015-08-10 12:33:01 +02:00 committed by Thomas Haller
parent b5a6883c10
commit f589c66b12
2 changed files with 3 additions and 4 deletions

View file

@ -220,7 +220,6 @@ _nm_audit_manager_log_connection_op (NMAuditManager *self, const char *file, gui
AuditField uuid_field = { }, name_field = { };
g_return_if_fail (op);
g_return_if_fail (connection || !strcmp (op, NM_AUDIT_OP_CONN_ADD));
fields = g_ptr_array_new ();

View file

@ -3258,7 +3258,7 @@ activation_add_done (NMSettings *self,
nm_settings_connection_delete (new_connection, NULL, NULL);
g_dbus_method_invocation_return_gerror (context, error);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
nm_active_connection_get_connection (info->active),
NULL,
FALSE,
nm_active_connection_get_subject (info->active),
error->message);
@ -3300,7 +3300,7 @@ _add_and_activate_auth_done (NMActiveConnection *active,
NM_MANAGER_ERROR_PERMISSION_DENIED,
error_desc);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE,
nm_active_connection_get_connection (active),
NULL,
FALSE,
nm_active_connection_get_subject (active),
error->message);
@ -3406,7 +3406,7 @@ impl_manager_add_and_activate_connection (NMManager *self,
return;
error:
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE, connection, FALSE, subject, error->message);
nm_audit_log_connection_op (NM_AUDIT_OP_CONN_ADD_ACTIVATE, NULL, FALSE, subject, error->message);
g_clear_object (&connection);
g_slist_free (all_connections);
g_clear_object (&subject);