mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
device: Use meson to generate fprint device permission flags
This commit is contained in:
committed by
Benjamin Berg
parent
e59f3cbc4f
commit
4c78012103
44
src/device.c
44
src/device.c
@ -30,6 +30,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "fprintd.h"
|
#include "fprintd.h"
|
||||||
|
#include "fprintd-enums.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
static const char *FINGERS_NAMES[] = {
|
static const char *FINGERS_NAMES[] = {
|
||||||
@ -68,13 +69,6 @@ typedef enum {
|
|||||||
STATE_IGNORED,
|
STATE_IGNORED,
|
||||||
} FprintDeviceClaimState;
|
} FprintDeviceClaimState;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
FPRINT_DEVICE_PERMISSION_NONE = 0,
|
|
||||||
FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 0),
|
|
||||||
FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 1),
|
|
||||||
FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 2),
|
|
||||||
} FprintDevicePermission;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* current method invocation */
|
/* current method invocation */
|
||||||
GDBusMethodInvocation *invocation;
|
GDBusMethodInvocation *invocation;
|
||||||
@ -135,39 +129,6 @@ enum fprint_device_signals {
|
|||||||
static guint32 last_id = ~0;
|
static guint32 last_id = ~0;
|
||||||
static guint signals[NUM_SIGNALS] = { 0, };
|
static guint signals[NUM_SIGNALS] = { 0, };
|
||||||
|
|
||||||
static GType
|
|
||||||
fprint_device_permission_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize define_type_id = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&define_type_id)) {
|
|
||||||
static const GFlagsValue values[] = {
|
|
||||||
{
|
|
||||||
FPRINT_DEVICE_PERMISSION_ENROLL,
|
|
||||||
"FPRINT_DEVICE_PERMISSION_ENROLL",
|
|
||||||
"net.reactivated.fprint.device.enroll"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FPRINT_DEVICE_PERMISSION_SETUSERNAME,
|
|
||||||
"FPRINT_DEVICE_PERMISSION_SETUSERNAME",
|
|
||||||
"net.reactivated.fprint.device.setusername"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FPRINT_DEVICE_PERMISSION_VERIFY,
|
|
||||||
"FPRINT_DEVICE_PERMISSION_VERIFY",
|
|
||||||
"net.reactivated.fprint.device.verify"
|
|
||||||
},
|
|
||||||
{ 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
GType type_id = g_flags_register_static (
|
|
||||||
"FprintDevicePermission", values);
|
|
||||||
g_once_init_leave (&define_type_id, type_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return define_type_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void session_data_free(SessionData *session)
|
static void session_data_free(SessionData *session)
|
||||||
{
|
{
|
||||||
g_clear_pointer(&session->sender, g_free);
|
g_clear_pointer(&session->sender, g_free);
|
||||||
@ -525,8 +486,7 @@ fprint_device_check_polkit_for_permissions (FprintDevice *rdev,
|
|||||||
if (permissions == FPRINT_DEVICE_PERMISSION_NONE)
|
if (permissions == FPRINT_DEVICE_PERMISSION_NONE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
permission_flags =
|
permission_flags = g_type_class_ref (FPRINT_TYPE_DEVICE_PERMISSION);
|
||||||
g_type_class_ref (fprint_device_permission_get_type ());
|
|
||||||
|
|
||||||
for (i = 0; i < permission_flags->n_values; ++i) {
|
for (i = 0; i < permission_flags->n_values; ++i) {
|
||||||
GFlagsValue *value = &permission_flags->values[i];
|
GFlagsValue *value = &permission_flags->values[i];
|
||||||
|
|||||||
@ -45,6 +45,13 @@ typedef enum {
|
|||||||
FPRINT_ERROR_NO_SUCH_DEVICE, /* device does not exist */
|
FPRINT_ERROR_NO_SUCH_DEVICE, /* device does not exist */
|
||||||
} FprintError;
|
} FprintError;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FPRINT_DEVICE_PERMISSION_NONE = 0,
|
||||||
|
FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 0), /*< nick=net.reactivated.fprint.device.enroll >*/
|
||||||
|
FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 1), /*< nick=net.reactivated.fprint.device.setusername >*/
|
||||||
|
FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 2), /*< nick=net.reactivated.fprint.device.verify >*/
|
||||||
|
} FprintDevicePermission;
|
||||||
|
|
||||||
/* Manager */
|
/* Manager */
|
||||||
#define FPRINT_TYPE_MANAGER (fprint_manager_get_type())
|
#define FPRINT_TYPE_MANAGER (fprint_manager_get_type())
|
||||||
G_DECLARE_FINAL_TYPE (FprintManager, fprint_manager, FPRINT, MANAGER, GObject)
|
G_DECLARE_FINAL_TYPE (FprintManager, fprint_manager, FPRINT, MANAGER, GObject)
|
||||||
|
|||||||
@ -22,11 +22,16 @@ fprintd_dbus_sources = gnome.gdbus_codegen('fprintd-dbus',
|
|||||||
object_manager: true,
|
object_manager: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fprintd_enum_files = gnome.mkenums_simple('fprintd-enums',
|
||||||
|
sources: 'fprintd.h',
|
||||||
|
)
|
||||||
|
|
||||||
fprintd_deps = declare_dependency(
|
fprintd_deps = declare_dependency(
|
||||||
include_directories: [
|
include_directories: [
|
||||||
include_directories('..'),
|
include_directories('..'),
|
||||||
],
|
],
|
||||||
sources: [
|
sources: [
|
||||||
|
fprintd_enum_files,
|
||||||
fprintd_dbus_sources,
|
fprintd_dbus_sources,
|
||||||
],
|
],
|
||||||
dependencies: [
|
dependencies: [
|
||||||
|
|||||||
Reference in New Issue
Block a user