summaryrefslogtreecommitdiff
path: root/src/home/homed-manager.h
blob: 851b302f59346b7cb7ace7f5f1a09f8140207902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <openssl/evp.h>

#include "sd-bus.h"
#include "sd-device.h"
#include "sd-event.h"

typedef struct Manager Manager;

#include "hashmap.h"
#include "homed-home.h"
#include "varlink.h"

#define HOME_UID_MIN 60001
#define HOME_UID_MAX 60513

struct Manager {
        sd_event *event;
        sd_bus *bus;

        Hashmap *polkit_registry;

        Hashmap *homes_by_uid;
        Hashmap *homes_by_name;
        Hashmap *homes_by_worker_pid;
        Hashmap *homes_by_sysfs;

        bool scan_slash_home;
        UserStorage default_storage;
        char *default_file_system_type;

        sd_event_source *inotify_event_source;

        /* An event source we receive sd_notify() messages from our worker from */
        sd_event_source *notify_socket_event_source;

        sd_device_monitor *device_monitor;

        sd_event_source *deferred_rescan_event_source;
        sd_event_source *deferred_gc_event_source;
        sd_event_source *deferred_auto_login_event_source;

        Home *gc_focus;

        VarlinkServer *varlink_server;
        char *userdb_service;

        EVP_PKEY *private_key; /* actually a pair of private and public key */
        Hashmap *public_keys; /* key name [char*] → publick key [EVP_PKEY*] */
};

int manager_new(Manager **ret);
Manager* manager_free(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);

int manager_startup(Manager *m);

int manager_augment_record_with_uid(Manager *m, UserRecord *hr);

int manager_enqueue_rescan(Manager *m);
int manager_enqueue_gc(Manager *m, Home *focus);

int manager_verify_user_record(Manager *m, UserRecord *hr);

int manager_acquire_key_pair(Manager *m);
int manager_sign_user_record(Manager *m, UserRecord *u, UserRecord **ret, sd_bus_error *error);

int bus_manager_emit_auto_login_changed(Manager *m);