Commit 1ab87a86 authored by Niels De Graef's avatar Niels De Graef

session-linux-auditor: use G_DECLARE_FINAL_TYPE

parent 3d3cc6ab
......@@ -37,8 +37,9 @@
#include "gdm-common.h"
struct _GdmSessionLinuxAuditorPrivate
struct _GdmSessionLinuxAuditor
{
GdmSessionAuditor parent;
int audit_fd;
};
......@@ -73,12 +74,12 @@ log_user_message (GdmSessionAuditor *auditor,
if (pw != NULL) {
g_snprintf (buf, sizeof (buf), "uid=%d", pw->pw_uid);
audit_log_user_message (linux_auditor->priv->audit_fd, type,
audit_log_user_message (linux_auditor->audit_fd, type,
buf, hostname, NULL, display_device,
result);
} else {
g_snprintf (buf, sizeof (buf), "acct=%s", username);
audit_log_user_message (linux_auditor->priv->audit_fd, type,
audit_log_user_message (linux_auditor->audit_fd, type,
buf, hostname, NULL, display_device,
result);
}
......@@ -122,18 +123,12 @@ gdm_session_linux_auditor_class_init (GdmSessionLinuxAuditorClass *klass)
auditor_class->report_login = gdm_session_linux_auditor_report_login;
auditor_class->report_login_failure = gdm_session_linux_auditor_report_login_failure;
auditor_class->report_logout = gdm_session_linux_auditor_report_logout;
g_type_class_add_private (auditor_class, sizeof (GdmSessionLinuxAuditorPrivate));
}
static void
gdm_session_linux_auditor_init (GdmSessionLinuxAuditor *auditor)
{
auditor->priv = G_TYPE_INSTANCE_GET_PRIVATE (auditor,
GDM_TYPE_SESSION_LINUX_AUDITOR,
GdmSessionLinuxAuditorPrivate);
auditor->priv->audit_fd = audit_open ();
auditor->audit_fd = audit_open ();
}
static void
......@@ -144,7 +139,7 @@ gdm_session_linux_auditor_finalize (GObject *object)
linux_auditor = GDM_SESSION_LINUX_AUDITOR (object);
close (linux_auditor->priv->audit_fd);
close (linux_auditor->audit_fd);
parent_class = G_OBJECT_CLASS (gdm_session_linux_auditor_parent_class);
if (parent_class->finalize != NULL) {
......
......@@ -32,32 +32,12 @@
#include "gdm-session-auditor.h"
G_BEGIN_DECLS
#define GDM_TYPE_SESSION_LINUX_AUDITOR (gdm_session_linux_auditor_get_type ())
#define GDM_SESSION_LINUX_AUDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDM_TYPE_SESSION_LINUX_AUDITOR, GdmSessionLinuxAuditor))
#define GDM_SESSION_LINUX_AUDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDM_TYPE_SESSION_LINUX_AUDITOR, GdmSessionLinuxAuditorClass))
#define GDM_IS_SESSION_LINUX_AUDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDM_TYPE_SESSION_LINUX_AUDITOR))
#define GDM_IS_SESSION_LINUX_AUDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDM_TYPE_SESSION_LINUX_AUDITOR))
#define GDM_SESSION_LINUX_AUDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GDM_TYPE_SESSION_LINUX_AUDITOR, GdmSessionLinuxAuditorClass))
#define GDM_SESSION_LINUX_AUDITOR_ERROR (gdm_session_linux_auditor_error_quark ())
typedef struct _GdmSessionLinuxAuditor GdmSessionLinuxAuditor;
typedef struct _GdmSessionLinuxAuditorClass GdmSessionLinuxAuditorClass;
typedef struct _GdmSessionLinuxAuditorPrivate GdmSessionLinuxAuditorPrivate;
struct _GdmSessionLinuxAuditor
{
GdmSessionAuditor parent;
/*< private > */
GdmSessionLinuxAuditorPrivate *priv;
};
struct _GdmSessionLinuxAuditorClass
{
GdmSessionAuditorClass parent_class;
};
#define GDM_TYPE_SESSION_LINUX_AUDITOR (gdm_session_linux_auditor_get_type ())
G_DECLARE_FINAL_TYPE (GdmSessionLinuxAuditor, gdm_session_linux_auditor, GDM, SESSION_LINUX_AUDITOR, GdmSessionAuditor)
GType gdm_session_linux_auditor_get_type (void);
GdmSessionAuditor *gdm_session_linux_auditor_new (const char *hostname,
const char *display_device);
G_END_DECLS
#endif /* GDM_SESSION_LINUX_AUDITOR_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment