summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2017-03-04 00:21:22 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2017-03-04 00:25:32 +0100
commitc8fdff2435faf404e3eb9d60b6584859f1951a3c (patch)
tree11ab7e454497b31c795790c568a4463ecc51af47
parent13bc2b3dad12af13f5089a5271d387cb7eff28ec (diff)
downloadNetworkManager-bg/bond-reapply-rh1348198.tar.gz
device: add list of changed properties to reapply audit logbg/bond-reapply-rh1348198
-rw-r--r--src/devices/nm-device.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e4f25c6d93..059e7d6206 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8533,6 +8533,7 @@ reapply_connection (NMDevice *self, NMConnection *con_old, NMConnection *con_new
* the current settings connection
* @version_id: either zero, or the current version id for the applied
* connection.
+ * @audit_args: on return, a string representing the changes
* @error: the error if %FALSE is returned
*
* Change configuration of an already configured device if possible.
@@ -8544,6 +8545,7 @@ static gboolean
check_and_reapply_connection (NMDevice *self,
NMConnection *connection,
guint64 version_id,
+ char **audit_args,
GError **error)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
@@ -8568,6 +8570,9 @@ check_and_reapply_connection (NMDevice *self,
NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS,
&diffs);
+ if (nm_audit_manager_audit_enabled (nm_audit_manager_get ()))
+ *audit_args = nm_utils_format_con_diff_for_audit (diffs);
+
/**************************************************************************
* check for unsupported changes and reject to reapply
*************************************************************************/
@@ -8667,6 +8672,7 @@ reapply_cb (NMDevice *self,
guint64 version_id = 0;
gs_unref_object NMConnection *connection = NULL;
GError *local = NULL;
+ gs_free char *audit_args = NULL;
if (reapply_data) {
connection = reapply_data->connection;
@@ -8683,12 +8689,13 @@ reapply_cb (NMDevice *self,
if (!check_and_reapply_connection (self,
connection ? : (NMConnection *) nm_device_get_settings_connection (self),
version_id,
+ &audit_args,
&local)) {
- nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, NULL, subject, local->message);
+ nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, audit_args, subject, local->message);
g_dbus_method_invocation_take_error (context, local);
local = NULL;
} else {
- nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, TRUE, NULL, subject, NULL);
+ nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, TRUE, audit_args, subject, NULL);
g_dbus_method_invocation_return_value (context, NULL);
}
}