diff options
| author | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2015-01-22 00:29:39 +0100 |
| commit | 2c032d8f1c6292c1338a615e6ec40252889ba85c (patch) | |
| tree | 1f77182220b2b0264288ba4a476ab47e5bc48716 /src/nm-auth-subject.h | |
| parent | 33491bc4279481db8ae47213e34a6d695a0e8830 (diff) | |
Imported Upstream version 1.0.0 upstream/1.0.0
Diffstat (limited to 'src/nm-auth-subject.h')
| -rw-r--r-- | src/nm-auth-subject.h | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/src/nm-auth-subject.h b/src/nm-auth-subject.h index 06359890..cc004fa9 100644 --- a/src/nm-auth-subject.h +++ b/src/nm-auth-subject.h @@ -18,8 +18,8 @@ * Copyright (C) 2013 Red Hat, Inc. */ -#ifndef NM_AUTH_SUBJECT_H -#define NM_AUTH_SUBJECT_H +#ifndef __NETWORKMANAGER_AUTH_SUBJECT_H__ +#define __NETWORKMANAGER_AUTH_SUBJECT_H__ #include <config.h> #include <glib.h> @@ -27,9 +27,7 @@ #include <dbus/dbus.h> #include <dbus/dbus-glib.h> -#if WITH_POLKIT -#include <polkit/polkit.h> -#endif +#include "nm-types.h" #define NM_TYPE_AUTH_SUBJECT (nm_auth_subject_get_type ()) #define NM_AUTH_SUBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AUTH_SUBJECT, NMAuthSubject)) @@ -38,33 +36,56 @@ #define NM_IS_AUTH_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AUTH_SUBJECT)) #define NM_AUTH_SUBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AUTH_SUBJECT, NMAuthSubjectClass)) -typedef struct { +typedef enum { + NM_AUTH_SUBJECT_TYPE_INVALID = 0, + NM_AUTH_SUBJECT_TYPE_INTERNAL = 1, + NM_AUTH_SUBJECT_TYPE_UNIX_PROCESS = 2, +} NMAuthSubjectType; + +#define NM_AUTH_SUBJECT_SUBJECT_TYPE "subject-type" +#define NM_AUTH_SUBJECT_UNIX_PROCESS_DBUS_SENDER "unix-process-dbus-sender" +#define NM_AUTH_SUBJECT_UNIX_PROCESS_PID "unix-process-pid" +#define NM_AUTH_SUBJECT_UNIX_PROCESS_UID "unix-process-uid" + +struct _NMAuthSubject { GObject parent; -} NMAuthSubject; +}; typedef struct { GObjectClass parent; - } NMAuthSubjectClass; GType nm_auth_subject_get_type (void); -NMAuthSubject *nm_auth_subject_new_from_context (DBusGMethodInvocation *context); +NMAuthSubject *nm_auth_subject_new_internal (void); + +NMAuthSubject *nm_auth_subject_new_unix_process_from_context (DBusGMethodInvocation *context); -NMAuthSubject *nm_auth_subject_new_from_message (DBusConnection *connection, DBusMessage *message); +NMAuthSubject *nm_auth_subject_new_unix_process_from_message (DBusConnection *connection, DBusMessage *message); -NMAuthSubject *nm_auth_subject_new_internal (void); -gulong nm_auth_subject_get_uid (NMAuthSubject *subject); +NMAuthSubjectType nm_auth_subject_get_subject_type (NMAuthSubject *subject); -gulong nm_auth_subject_get_pid (NMAuthSubject *subject); -const char *nm_auth_subject_get_dbus_sender (NMAuthSubject *subject); +gboolean nm_auth_subject_is_internal (NMAuthSubject *subject); -gboolean nm_auth_subject_get_internal (NMAuthSubject *subject); + +gboolean nm_auth_subject_is_unix_process (NMAuthSubject *subject); + +gulong nm_auth_subject_get_unix_process_pid (NMAuthSubject *subject); + +const char *nm_auth_subject_get_unix_process_dbus_sender (NMAuthSubject *subject); + + +gulong nm_auth_subject_get_unix_process_uid (NMAuthSubject *subject); + + +const char *nm_auth_subject_to_string (NMAuthSubject *self, char *buf, gsize buf_len); #if WITH_POLKIT -PolkitSubject *nm_auth_subject_get_polkit_subject (NMAuthSubject *subject); + +GVariant * nm_auth_subject_unix_process_to_polkit_gvariant (NMAuthSubject *self); + #endif -#endif /* NM_AUTH_SUBJECT_H */ +#endif /* __NETWORKMANAGER_AUTH_SUBJECT_H__ */ |