summaryrefslogtreecommitdiffstats
path: root/src/shared/creds-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-11-22 10:57:20 +0100
committerLennart Poettering <lennart@poettering.net>2023-12-18 11:10:14 +0100
commit58982cf0cb42e43157a48e6e32f18b831d84f5d0 (patch)
treeadd49a68833741531dce85f8295584f994406524 /src/shared/creds-util.c
parentMerge pull request #30479 from keszybz/man-pages-synopsis-layout (diff)
downloadsystemd-58982cf0cb42e43157a48e6e32f18b831d84f5d0.tar.xz
systemd-58982cf0cb42e43157a48e6e32f18b831d84f5d0.zip
creds-util: add helper for opening the credentials directory
Diffstat (limited to 'src/shared/creds-util.c')
-rw-r--r--src/shared/creds-util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shared/creds-util.c b/src/shared/creds-util.c
index 7cc8889595..0026da5b48 100644
--- a/src/shared/creds-util.c
+++ b/src/shared/creds-util.c
@@ -100,6 +100,17 @@ int get_encrypted_credentials_dir(const char **ret) {
return get_credentials_dir_internal("ENCRYPTED_CREDENTIALS_DIRECTORY", ret);
}
+int open_credentials_dir(void) {
+ const char *d;
+ int r;
+
+ r = get_credentials_dir(&d);
+ if (r < 0)
+ return r;
+
+ return RET_NERRNO(open(d, O_CLOEXEC|O_DIRECTORY));
+}
+
int read_credential(const char *name, void **ret, size_t *ret_size) {
_cleanup_free_ char *fn = NULL;
const char *d;