chiark / gitweb /
sd-bus: don't leak kdbus notifications
[elogind.git] / src / libelogind / sd-bus / bus-creds.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2013 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   systemd is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <stdbool.h>
25
26 #include "sd-bus.h"
27
28 struct sd_bus_creds {
29         bool allocated;
30         unsigned n_ref;
31
32         uint64_t mask;
33         uint64_t augmented;
34
35         uid_t uid;
36         uid_t euid;
37         uid_t suid;
38         uid_t fsuid;
39         gid_t gid;
40         gid_t egid;
41         gid_t sgid;
42         gid_t fsgid;
43
44         gid_t *supplementary_gids;
45         unsigned n_supplementary_gids;
46
47         pid_t ppid;
48         pid_t pid;
49         pid_t tid;
50
51         char *comm;
52         char *tid_comm;
53         char *exe;
54
55         char *cmdline;
56         size_t cmdline_size;
57         char **cmdline_array;
58
59         char *cgroup;
60         char *session;
61         char *unit;
62         char *user_unit;
63         char *slice;
64         char *user_slice;
65
66         char *tty;
67
68         uint32_t *capability;
69
70         uint32_t audit_session_id;
71         uid_t audit_login_uid;
72
73         char *label;
74
75         char *unique_name;
76
77         char **well_known_names;
78         bool well_known_names_driver:1;
79         bool well_known_names_local:1;
80
81         char *cgroup_root;
82
83         char *description, *unescaped_description;
84 };
85
86 sd_bus_creds* bus_creds_new(void);
87
88 void bus_creds_done(sd_bus_creds *c);
89
90 int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid);
91
92 int bus_creds_extend_by_pid(sd_bus_creds *c, uint64_t mask, sd_bus_creds **ret);