1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <stdbool.h>
5 
6 #include "sd-bus.h"
7 
8 struct sd_bus_creds {
9         bool allocated;
10         unsigned n_ref;
11 
12         uint64_t mask;
13         uint64_t augmented;
14 
15         uid_t uid;
16         uid_t euid;
17         uid_t suid;
18         uid_t fsuid;
19         gid_t gid;
20         gid_t egid;
21         gid_t sgid;
22         gid_t fsgid;
23 
24         gid_t *supplementary_gids;
25         unsigned n_supplementary_gids;
26 
27         pid_t ppid;
28         pid_t pid;
29         pid_t tid;
30 
31         char *comm;
32         char *tid_comm;
33         char *exe;
34 
35         char *cmdline;
36         size_t cmdline_size;
37         char **cmdline_array;
38 
39         char *cgroup;
40         char *session;
41         char *unit;
42         char *user_unit;
43         char *slice;
44         char *user_slice;
45 
46         char *tty;
47 
48         uint32_t *capability;
49 
50         uint32_t audit_session_id;
51         uid_t audit_login_uid;
52 
53         char *label;
54 
55         char *unique_name;
56 
57         char **well_known_names;
58         bool well_known_names_driver:1;
59         bool well_known_names_local:1;
60 
61         char *cgroup_root;
62 
63         char *description, *unescaped_description;
64 };
65 
66 sd_bus_creds* bus_creds_new(void);
67 
68 void bus_creds_done(sd_bus_creds *c);
69 
70 int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid);
71 
72 int bus_creds_extend_by_pid(sd_bus_creds *c, uint64_t mask, sd_bus_creds **ret);
73