mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 21:20:10 +01:00
Clone the connection upon activation. This makes it safe for the user to modify the original connection while it is activated. This involves several changes: - NMActiveConnection gets @settings_connection and @applied_connection. To support add-and-activate, we constructing a NMActiveConnection with no connection set. Previously, we would set the "connection" field to a temporary NMConnection. Now NMManager piggybacks this temporary connection as object-data (TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE). - get rid of the functions nm_active_connection_get_connection_type() and nm_active_connection_get_connection_uuid(). From their names it is unclear whether this returns the settings or applied connection. The (few) callers should figure that out themselves. - rename nm_active_connection_get_id() to nm_active_connection_get_settings_connection_id(). This function is only used internally for logging. - dispatcher calls now get two connections as well. The applied-connection is used for the connection data, while the settings-connection is used for the connection path. - needs special handling for properties that apply immediately when changed (nm_device_reapply_settings_immediately()). Co-Authored-By: Thomas Haller <thaller@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=724041
113 lines
4.9 KiB
C
113 lines
4.9 KiB
C
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
/* NetworkManager audit support
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
*
|
|
* Copyright 2015 Red Hat, Inc.
|
|
*/
|
|
|
|
#ifndef __NM_AUDIT_MANAGER_H__
|
|
#define __NM_AUDIT_MANAGER_H__
|
|
|
|
#include <glib.h>
|
|
#include <glib-object.h>
|
|
|
|
#include "nm-connection.h"
|
|
#include "nm-device.h"
|
|
#include "nm-types.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define NM_TYPE_AUDIT_MANAGER (nm_audit_manager_get_type ())
|
|
#define NM_AUDIT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManager))
|
|
#define NM_AUDIT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
#define NM_IS_AUDIT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AUDIT_MANAGER))
|
|
#define NM_IS_AUDIT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AUDIT_MANAGER))
|
|
#define NM_AUDIT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AUDIT_MANAGER, NMAuditManagerClass))
|
|
|
|
struct _NMAuditManager {
|
|
GObject parent;
|
|
};
|
|
|
|
typedef struct {
|
|
GObjectClass parent;
|
|
} NMAuditManagerClass;
|
|
|
|
#define NM_AUDIT_OP_CONN_ADD "connection-add"
|
|
#define NM_AUDIT_OP_CONN_DELETE "connection-delete"
|
|
#define NM_AUDIT_OP_CONN_UPDATE "connection-update"
|
|
#define NM_AUDIT_OP_CONN_ACTIVATE "connection-activate"
|
|
#define NM_AUDIT_OP_CONN_ADD_ACTIVATE "connection-add-activate"
|
|
#define NM_AUDIT_OP_CONN_DEACTIVATE "connection-deactivate"
|
|
#define NM_AUDIT_OP_CONN_CLEAR_SECRETS "connection-clear-secrets"
|
|
|
|
#define NM_AUDIT_OP_SLEEP_CONTROL "sleep-control"
|
|
#define NM_AUDIT_OP_NET_CONTROL "networking-control"
|
|
#define NM_AUDIT_OP_RADIO_CONTROL "radio-control"
|
|
|
|
#define NM_AUDIT_OP_DEVICE_AUTOCONNECT "device-autoconnect"
|
|
#define NM_AUDIT_OP_DEVICE_DISCONNECT "device-disconnect"
|
|
#define NM_AUDIT_OP_DEVICE_DELETE "device-delete"
|
|
#define NM_AUDIT_OP_DEVICE_MANAGED "device-managed"
|
|
|
|
GType nm_audit_manager_get_type (void);
|
|
NMAuditManager *nm_audit_manager_get (void);
|
|
gboolean nm_audit_manager_audit_enabled (NMAuditManager *self);
|
|
|
|
#define nm_audit_log_connection_op(op, connection, result, subject, reason) \
|
|
G_STMT_START { \
|
|
NMAuditManager *_audit = nm_audit_manager_get (); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled (_audit)) { \
|
|
_nm_audit_manager_log_connection_op (_audit, __FILE__, __LINE__, G_STRFUNC, \
|
|
(op), (connection), (result), (subject), \
|
|
(reason)); \
|
|
} \
|
|
} G_STMT_END
|
|
|
|
#define nm_audit_log_control_op(op, arg, result, subject, reason) \
|
|
G_STMT_START { \
|
|
NMAuditManager *_audit = nm_audit_manager_get (); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled (_audit)) { \
|
|
_nm_audit_manager_log_control_op (_audit, __FILE__, __LINE__, G_STRFUNC, \
|
|
(op), (arg), (result), (subject), (reason)); \
|
|
} \
|
|
} G_STMT_END
|
|
|
|
#define nm_audit_log_device_op(op, device, result, subject, reason) \
|
|
G_STMT_START { \
|
|
NMAuditManager *_audit = nm_audit_manager_get (); \
|
|
\
|
|
if (nm_audit_manager_audit_enabled (_audit)) { \
|
|
_nm_audit_manager_log_device_op (_audit, __FILE__, __LINE__, G_STRFUNC, \
|
|
(op), (device), (result), (subject), (reason)); \
|
|
} \
|
|
} G_STMT_END
|
|
|
|
void _nm_audit_manager_log_connection_op (NMAuditManager *self, const char *file, guint line,
|
|
const char *func, const char *op, NMSettingsConnection *connection,
|
|
gboolean result, NMAuthSubject *subject, const char *reason);
|
|
|
|
void _nm_audit_manager_log_control_op (NMAuditManager *self, const char *file, guint line,
|
|
const char *func, const char *op, const char *arg,
|
|
gboolean result, NMAuthSubject *subject, const char *reason);
|
|
|
|
void _nm_audit_manager_log_device_op (NMAuditManager *self, const char *file, guint line,
|
|
const char *func, const char *op, NMDevice *device,
|
|
gboolean result, NMAuthSubject *subject, const char *reason);
|
|
G_END_DECLS
|
|
|
|
#endif /* __NM_AUDIT_MANAGER_H__ */
|