| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "core-forward.h" |
| 5 |
|
| 6 |
/* A credential configured with LoadCredential= */ |
| 7 |
typedef struct ExecLoadCredential { |
| 8 |
char *id; |
| 9 |
char *path; |
| 10 |
bool encrypted; |
| 11 |
} ExecLoadCredential; |
| 12 |
|
| 13 |
/* A credential configured with SetCredential= */ |
| 14 |
typedef struct ExecSetCredential { |
| 15 |
char *id; |
| 16 |
bool encrypted; |
| 17 |
void *data; |
| 18 |
size_t size; |
| 19 |
} ExecSetCredential; |
| 20 |
|
| 21 |
typedef struct ExecImportCredential { |
| 22 |
char *glob; |
| 23 |
char *rename; |
| 24 |
} ExecImportCredential; |
| 25 |
|
| 26 |
ExecSetCredential* exec_set_credential_free(ExecSetCredential *sc); |
| 27 |
DEFINE_TRIVIAL_CLEANUP_FUNC(ExecSetCredential*, exec_set_credential_free); |
| 28 |
|
| 29 |
ExecLoadCredential* exec_load_credential_free(ExecLoadCredential *lc); |
| 30 |
DEFINE_TRIVIAL_CLEANUP_FUNC(ExecLoadCredential*, exec_load_credential_free); |
| 31 |
|
| 32 |
ExecImportCredential* exec_import_credential_free(ExecImportCredential *ic); |
| 33 |
DEFINE_TRIVIAL_CLEANUP_FUNC(ExecImportCredential*, exec_import_credential_free); |
| 34 |
|
| 35 |
int exec_context_put_load_credential(ExecContext *c, const char *id, const char *path, bool encrypted); |
| 36 |
int exec_context_put_set_credential( |
| 37 |
ExecContext *c, |
| 38 |
const char *id, |
| 39 |
void *data_consume, |
| 40 |
size_t size, |
| 41 |
bool encrypted); |
| 42 |
int exec_context_put_import_credential(ExecContext *c, const char *glob, const char *rename); |
| 43 |
|
| 44 |
bool exec_params_need_credentials(const ExecParameters *p); |
| 45 |
|
| 46 |
bool exec_context_has_credentials(const ExecContext *c); |
| 47 |
|
| 48 |
int exec_context_get_credential_directory( |
| 49 |
const ExecContext *context, |
| 50 |
const ExecParameters *params, |
| 51 |
const char *unit, |
| 52 |
char **ret); |
| 53 |
|
| 54 |
int exec_context_destroy_credentials(const ExecContext *c, const char *runtime_prefix, const char *unit); |
| 55 |
|
| 56 |
int exec_setup_credentials( |
| 57 |
const ExecContext *context, |
| 58 |
const CGroupContext *cgroup_context, |
| 59 |
const ExecParameters *params, |
| 60 |
uid_t uid, |
| 61 |
gid_t gid); |
| 62 |
|
| 63 |
int unit_refresh_credentials(Unit *u); |
| 64 |
|
| 65 |
bool mount_point_is_credentials(const char *runtime_prefix, const char *path); |