]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/exec-credential.h
core: align table
[thirdparty/systemd.git] / src / core / exec-credential.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdbool.h>
5 #include <stdint.h>
6 #include <unistd.h>
7
8 #include "hash-funcs.h"
9
10 typedef struct ExecContext ExecContext;
11 typedef struct ExecParameters ExecParameters;
12 typedef struct Unit Unit;
13
14 /* A credential configured with LoadCredential= */
15 typedef struct ExecLoadCredential {
16 char *id, *path;
17 bool encrypted;
18 } ExecLoadCredential;
19
20 /* A credential configured with SetCredential= */
21 typedef struct ExecSetCredential {
22 char *id;
23 bool encrypted;
24 void *data;
25 size_t size;
26 } ExecSetCredential;
27
28 ExecSetCredential *exec_set_credential_free(ExecSetCredential *sc);
29 DEFINE_TRIVIAL_CLEANUP_FUNC(ExecSetCredential*, exec_set_credential_free);
30
31 ExecLoadCredential *exec_load_credential_free(ExecLoadCredential *lc);
32 DEFINE_TRIVIAL_CLEANUP_FUNC(ExecLoadCredential*, exec_load_credential_free);
33
34 extern const struct hash_ops exec_set_credential_hash_ops;
35 extern const struct hash_ops exec_load_credential_hash_ops;
36
37 bool exec_params_need_credentials(const ExecParameters *p);
38
39 bool exec_context_has_credentials(const ExecContext *c);
40 bool exec_context_has_encrypted_credentials(const ExecContext *c);
41
42 int exec_context_get_credential_directory(
43 const ExecContext *context,
44 const ExecParameters *params,
45 const char *unit,
46 char **ret);
47
48 int unit_add_default_credential_dependencies(Unit *u, const ExecContext *c);
49
50 int exec_context_destroy_credentials(Unit *u);
51 int exec_setup_credentials(
52 const ExecContext *context,
53 const ExecParameters *params,
54 const char *unit,
55 uid_t uid,
56 gid_t gid);